From 3f8895d4cb6eae20766329a0641ade48e3cffaf8 Mon Sep 17 00:00:00 2001 From: Nate-Wessel Date: Thu, 11 Jul 2024 20:42:01 +0000 Subject: [PATCH] queue belongs to object --- frontend/src/spatialData.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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() )