Skip to content

Commit

Permalink
queue belongs to object
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate-Wessel committed Jul 11, 2024
1 parent b90a323 commit 3f8895d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frontend/src/spatialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import { TravelTimeQuery } from './travelTimeQuery.js'
import { domain } from './domain.js'
import PQueue from 'p-queue'

const queue = new PQueue({concurrency: 3})

// instantiated once, this is the data store for all spatial and temporal data
export class SpatialData {
#factors = []
#queries = new Map() // store/cache for travelTimeQueries, letting them remember their results if any
#knownHolidays = []
#queue = new PQueue({concurrency: 3})
constructor(){
this.#factors.push(new Days(this))
this.#factors.push(new HolidayOption(this,true))
Expand Down Expand Up @@ -119,7 +118,7 @@ export class SpatialData {
return [...this.#queries.values()].sort((a,b)=> a.URI < b.URI ? -1 : 1)
}
fetchAllResults(){
return queue.addAll(
return this.#queue.addAll(
this.travelTimeQueries
.filter( TTQ => ! TTQ.hasData )
.map( TTQ => () => TTQ.fetchData() )
Expand Down

0 comments on commit 3f8895d

Please sign in to comment.