diff --git a/frontend/src/spatialData.js b/frontend/src/spatialData.js index b874547..93d1650 100644 --- a/frontend/src/spatialData.js +++ b/frontend/src/spatialData.js @@ -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)) @@ -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() )