Skip to content

Commit aaeed97

Browse files
committed
OdTripSimulation: use a new progress emitter instead of the parent's
To avoid conflicting progress and checkpoint events with the parent job, a new progress event emitter is created for each child job.
1 parent 68130f5 commit aaeed97

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/transition-backend/src/services/simulation/methods/OdTripSimulation.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { OdTripRouteResult } from '../../transitRouting/types';
2424
import { BatchRouteJobType } from '../../transitRouting/BatchRoutingJob';
2525
import { fileKey } from 'transition-common/lib/services/jobs/Job';
2626
import { BatchCalculationParameters } from 'transition-common/lib/services/batchCalculation/types';
27+
import { EventEmitter } from 'events';
2728

2829
export const OdTripSimulationTitle = 'OdTripSimulation';
2930

@@ -249,8 +250,11 @@ export default class OdTripSimulation implements SimulationMethod {
249250

250251
// This is copied from wrapBatchRoute
251252
const { files, errors, warnings, ...result } = await batchRoute(routingJob,
252-
this.jobWrapper.privexecutorOptions
253-
);
253+
{
254+
// Child job needs its own progress emitter to avoid conflicts with the parent's
255+
progressEmitter: new EventEmitter(),
256+
isCancelled: this.jobWrapper.privexecutorOptions.isCancelled
257+
});
254258
routingJob.attributes.data.results = result;
255259
routingJob.attributes.resources = { files };
256260

0 commit comments

Comments
 (0)