@golemio/pid 2.8.6-dev.953248025 → 2.8.6-dev.955691187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +6 -23
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +0 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +72 -93
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/package.json +1 -1
package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js
CHANGED
|
@@ -31,17 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
35
|
-
var t = {};
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
-
t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
};
|
|
45
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
35
|
exports.CommonRunsRepository = void 0;
|
|
47
36
|
const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
|
|
@@ -98,18 +87,16 @@ class CommonRunsRepository extends models_2.PostgresModel {
|
|
|
98
87
|
const connection = connectors_1.PostgresConnector.getConnection();
|
|
99
88
|
const t = yield connection.transaction();
|
|
100
89
|
try {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
model: this.runsMessagesRepository["sequelizeModel"],
|
|
105
|
-
},
|
|
90
|
+
const [runRecord] = yield this.sequelizeModel.findOrCreate({
|
|
91
|
+
where: { id: run.id },
|
|
92
|
+
defaults: Object.assign({}, run),
|
|
106
93
|
transaction: t,
|
|
107
94
|
});
|
|
95
|
+
const runMessageRecord = yield this.runsMessagesRepository["sequelizeModel"].create(Object.assign(Object.assign({}, run_message), { runs_id: run.id }), { transaction: t });
|
|
108
96
|
yield t.commit();
|
|
109
|
-
const _a = record.get({ plain: true }), { run_messages: runMessageResult } = _a, runResult = __rest(_a, ["run_messages"]);
|
|
110
97
|
return {
|
|
111
|
-
run:
|
|
112
|
-
run_message:
|
|
98
|
+
run: runRecord.get({ plain: true }),
|
|
99
|
+
run_message: runMessageRecord.get({ plain: true }),
|
|
113
100
|
};
|
|
114
101
|
}
|
|
115
102
|
catch (err) {
|
|
@@ -118,21 +105,17 @@ class CommonRunsRepository extends models_2.PostgresModel {
|
|
|
118
105
|
}
|
|
119
106
|
});
|
|
120
107
|
this.updateAndAssociate = ({ run, run_message }, runId) => __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const connection = connectors_1.PostgresConnector.getConnection();
|
|
122
|
-
const t = yield connection.transaction();
|
|
123
108
|
try {
|
|
124
109
|
const [[, runRecord], runMessageRecord] = yield Promise.all([
|
|
125
110
|
this.update({ msg_last_timestamp: run.msg_last_timestamp }, { where: { id: runId }, returning: true, plain: true }),
|
|
126
111
|
this.runsMessagesRepository["sequelizeModel"].create(Object.assign(Object.assign({}, run_message), { runs_id: runId })),
|
|
127
112
|
]);
|
|
128
|
-
yield t.commit();
|
|
129
113
|
return {
|
|
130
114
|
run: runRecord.get({ plain: true }),
|
|
131
115
|
run_message: runMessageRecord.get({ plain: true }),
|
|
132
116
|
};
|
|
133
117
|
}
|
|
134
118
|
catch (err) {
|
|
135
|
-
yield t.rollback();
|
|
136
119
|
throw new golemio_errors_1.GeneralError("updateAndAssociate: error while saving to database", this.name, err);
|
|
137
120
|
}
|
|
138
121
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAgF;AAChF,mEAAuC;AACvC,uFAAgE;AAIhE,iFAAqF;AACrF,yEAAqF;AACrF,6EAAwE;AACxE,mFAAkF;AAClF,iFAAoE;AACpE,iFAA8E;AAE9E,MAAa,oBAAqB,SAAQ,sBAAa;IAgBnD;QACI,KAAK,CACD,sBAAsB,EACtB;YACI,WAAW,EAAE,wBAAe,CAAC,UAAU;YACvC,QAAQ,EAAE,iBAAS;YACnB,yBAAyB,EAAE,wBAAe,CAAC,cAAc;YACzD,UAAU,EAAE,YAAY;YACxB,2BAA2B,EAAE;gBACzB,OAAO,EAAE;oBACL;wBACI,MAAM,EAAE,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,4BAA4B;qBACrC;oBACD;wBACI,MAAM,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;wBAChF,IAAI,EAAE,2BAA2B;qBACpC;iBACJ;aACJ;SACJ,EACD,IAAI,uCAAmB,CAAC,+BAA+B,EAAE,wBAAe,CAAC,UAAU,CAAC,CACvF,CAAC;QAiBC,0BAAqB,GAAG,CAAC,GAAqB,EAAoC,EAA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P,CAAC,CAAC;QA5HE,IAAI,CAAC,sBAAsB,GAAG,IAAI,2DAA4B,EAAE,CAAC;QACjE,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE;YACzE,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,SAAS;SACtB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE;YACvE,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,SAAS;YACrB,EAAE,EAAE,cAAc;SACrB,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,GAAG,IAAI,oCAAsB,EAAE,CAAC;IAC/D,CAAC;CAgHJ;AArKD,oDAqKC"}
|
|
@@ -37,7 +37,6 @@ const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
|
37
37
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
38
38
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
39
39
|
const turf = __importStar(require("@turf/turf"));
|
|
40
|
-
const monitoring_1 = require("@golemio/core/dist/monitoring");
|
|
41
40
|
class DelayComputationManager {
|
|
42
41
|
constructor(gtfsTripsRepository) {
|
|
43
42
|
this.gtfsTripsRepository = gtfsTripsRepository;
|
|
@@ -48,15 +47,12 @@ class DelayComputationManager {
|
|
|
48
47
|
* @returns {IComputationTrip} - Result with shape anchor points
|
|
49
48
|
*/
|
|
50
49
|
this.getComputationObject = (tripId) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const computationObjectSpan = (0, monitoring_1.createChildSpan)("Task.UpdateDelay.GetComputationObject");
|
|
52
50
|
const stopTimes = yield this.gtfsTripsRepository.findByIdWithStopTimes(tripId);
|
|
53
51
|
const shapes = yield this.gtfsTripsRepository.findByIdWithShapes(tripId);
|
|
54
52
|
if (!shapes || !shapes.shape_id || !shapes.shapes || shapes.shapes.length === 0) {
|
|
55
|
-
computationObjectSpan === null || computationObjectSpan === void 0 ? void 0 : computationObjectSpan.end();
|
|
56
53
|
throw new golemio_errors_1.GeneralError(`"trip.shape_id" or "trip.shapes" was not found for id ${tripId}.`);
|
|
57
54
|
}
|
|
58
55
|
if (!stopTimes || !stopTimes.stop_times || stopTimes.stop_times.length === 0) {
|
|
59
|
-
computationObjectSpan === null || computationObjectSpan === void 0 ? void 0 : computationObjectSpan.end();
|
|
60
56
|
throw new golemio_errors_1.GeneralError(`"trip.stop_times" was not found for id ${tripId}.`);
|
|
61
57
|
}
|
|
62
58
|
const shapesGeometryAnchorPoints = this.getShapesGeometryAnchorPoints(stopTimes.shape_id, shapes.shapes, stopTimes.stop_times);
|
|
@@ -133,7 +129,6 @@ class DelayComputationManager {
|
|
|
133
129
|
time_scheduled_seconds: timeScheduledSeconds,
|
|
134
130
|
});
|
|
135
131
|
}
|
|
136
|
-
computationObjectSpan === null || computationObjectSpan === void 0 ? void 0 : computationObjectSpan.end();
|
|
137
132
|
return {
|
|
138
133
|
trip_id: tripId,
|
|
139
134
|
stop_times: stopTimes.stop_times,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yEAAsE;AACtE,2EAAoE;AACpE,6EAAwE;AACxE,iDAAmC;
|
|
1
|
+
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yEAAsE;AACtE,2EAAoE;AACpE,6EAAwE;AACxE,iDAAmC;AAGnC,MAAa,uBAAuB;IAChC,YAA6B,mBAAwC;QAAxC,wBAAmB,GA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C;gBACxE,mBAAmB,CAAC,IAAI,CAAC;oBACrB,QAAQ,EAAE,OAAO;oBACjB,aAAa,EAAE,KAAK;oBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;oBACjD,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,mBAAmB,EAAE,sBAAsB,GAAG,mBAAmB;iBACpE,CAAC,CAAC;aACN;YACD,OAAO,mBAAmB,CAAC;QAC/B,CAAC,CAAC;IA/QsE,CAAC;CAgR5E;AAjRD,0DAiRC"}
|
package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js
CHANGED
|
@@ -27,7 +27,6 @@ const PositionsManager_1 = __importDefault(require("../helpers/PositionsManager"
|
|
|
27
27
|
const TripStopsManager_1 = require("../helpers/TripStopsManager");
|
|
28
28
|
const VPUtils_1 = require("../helpers/VPUtils");
|
|
29
29
|
const UpdateDelaySchema_1 = require("../schema/UpdateDelaySchema");
|
|
30
|
-
const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
|
|
31
30
|
class UpdateDelayTask extends workers_1.AbstractTask {
|
|
32
31
|
constructor(queuePrefix) {
|
|
33
32
|
super(queuePrefix);
|
|
@@ -41,26 +40,18 @@ class UpdateDelayTask extends workers_1.AbstractTask {
|
|
|
41
40
|
* @returns {Object[]} - Arrays of inserted/updated positions and array of (inserted)/updated trips
|
|
42
41
|
*/
|
|
43
42
|
this.updateComputedPositionsAndTrips = (computedResult) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
positionsUpdated,
|
|
58
|
-
tripsUpdated,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
finally {
|
|
62
|
-
updateSpan === null || updateSpan === void 0 ? void 0 : updateSpan.end();
|
|
63
|
-
}
|
|
43
|
+
const positions = computedResult.flatMap((e) => e.positions);
|
|
44
|
+
const positionsUpdated = yield this.positionsRepository.bulkUpdate(positions);
|
|
45
|
+
const tripsUpdated = yield this.tripsRepository.bulkUpdate(computedResult.map((e) => ({
|
|
46
|
+
id: e.context.tripId,
|
|
47
|
+
last_position_id: e.context.lastPositionId,
|
|
48
|
+
last_position_context: e.context,
|
|
49
|
+
is_canceled: e.context.lastPositionCanceled,
|
|
50
|
+
})));
|
|
51
|
+
return {
|
|
52
|
+
positionsUpdated,
|
|
53
|
+
tripsUpdated,
|
|
54
|
+
};
|
|
64
55
|
});
|
|
65
56
|
this.tripsRepository = new TripsRepository_1.TripsRepository();
|
|
66
57
|
this.positionsRepository = new PositionsRepository_1.PositionsRepository();
|
|
@@ -76,82 +67,73 @@ class UpdateDelayTask extends workers_1.AbstractTask {
|
|
|
76
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
68
|
const tripIds = data.updatedTrips.map((trip) => trip.id);
|
|
78
69
|
if (((_a = data.positions) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
// unique ids in input data in key-value (id-positions) structure
|
|
71
|
+
let tripIdToPositionDict = {};
|
|
72
|
+
for (const position of data.positions) {
|
|
73
|
+
tripIdToPositionDict[position.trips_id] = position;
|
|
74
|
+
}
|
|
75
|
+
// unique block_ids and its parent input trips_id in key-value structure
|
|
76
|
+
let tripsIdsByBlockIds = {};
|
|
77
|
+
// unique block_ids and its parent gtfs_trip_id in key-value structure
|
|
78
|
+
let blockIdToTripIdsDict = {};
|
|
79
|
+
for (const trip of data.updatedTrips) {
|
|
80
|
+
if (!trip.gtfs_block_id) {
|
|
81
|
+
continue;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// unique block_ids and its parent gtfs_trip_id in key-value structure
|
|
90
|
-
let blockIdToTripIdsDict = {};
|
|
91
|
-
for (const trip of data.updatedTrips) {
|
|
92
|
-
if (!trip.gtfs_block_id) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (!tripsIdsByBlockIds[trip.gtfs_block_id]) {
|
|
96
|
-
tripsIdsByBlockIds[trip.gtfs_block_id] = trip.id;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
// save only the shorter trip_id (it is the raw input id with no suffixes)
|
|
100
|
-
tripsIdsByBlockIds[trip.gtfs_block_id] =
|
|
101
|
-
tripsIdsByBlockIds[trip.gtfs_block_id] > trip.id ? trip.id : tripsIdsByBlockIds[trip.gtfs_block_id];
|
|
102
|
-
}
|
|
103
|
-
if (!blockIdToTripIdsDict[trip.gtfs_block_id]) {
|
|
104
|
-
blockIdToTripIdsDict[trip.gtfs_block_id] = new Set();
|
|
105
|
-
}
|
|
106
|
-
if (trip.gtfs_trip_id) {
|
|
107
|
-
blockIdToTripIdsDict[trip.gtfs_block_id].add(trip.gtfs_trip_id);
|
|
108
|
-
}
|
|
83
|
+
if (!tripsIdsByBlockIds[trip.gtfs_block_id]) {
|
|
84
|
+
tripsIdsByBlockIds[trip.gtfs_block_id] = trip.id;
|
|
109
85
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return acc;
|
|
121
|
-
}), Promise.resolve({}));
|
|
122
|
-
// duplicate positions for trips with block_ids
|
|
123
|
-
for (const trip of data.updatedTrips) {
|
|
124
|
-
if (tripIdToPositionDict[trip.id]) {
|
|
125
|
-
if (trip.gtfs_block_id) {
|
|
126
|
-
// Determine current position tracking status
|
|
127
|
-
tripIdToPositionDict[trip.id].tracking = VPUtils_1.VPUtils.determineTrackingStatus(trip.gtfs_trip_id, blockIdToTripStopScheduleDict[trip.gtfs_block_id], tripIdToPositionDict[trip.id]);
|
|
128
|
-
}
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
const currentPosition = data.positions.find((position) => {
|
|
132
|
-
return position.trips_id === tripsIdsByBlockIds[trip.gtfs_block_id];
|
|
133
|
-
});
|
|
134
|
-
if (!currentPosition) {
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
// Determine position duplication and new position tracking status
|
|
138
|
-
const newPositionTrackingStatus = VPUtils_1.VPUtils.determineNewPositionTracking(blockIdToTripStopScheduleDict[trip.gtfs_block_id], trip, currentPosition);
|
|
139
|
-
// duplicate position with new created trip for second trip
|
|
140
|
-
const newPosition = Object.assign({}, currentPosition);
|
|
141
|
-
newPosition.trips_id = trip.id;
|
|
142
|
-
newPosition.tracking = newPositionTrackingStatus;
|
|
143
|
-
data.positions.push(newPosition);
|
|
86
|
+
else {
|
|
87
|
+
// save only the shorter trip_id (it is the raw input id with no suffixes)
|
|
88
|
+
tripsIdsByBlockIds[trip.gtfs_block_id] =
|
|
89
|
+
tripsIdsByBlockIds[trip.gtfs_block_id] > trip.id ? trip.id : tripsIdsByBlockIds[trip.gtfs_block_id];
|
|
90
|
+
}
|
|
91
|
+
if (!blockIdToTripIdsDict[trip.gtfs_block_id]) {
|
|
92
|
+
blockIdToTripIdsDict[trip.gtfs_block_id] = new Set();
|
|
93
|
+
}
|
|
94
|
+
if (trip.gtfs_trip_id) {
|
|
95
|
+
blockIdToTripIdsDict[trip.gtfs_block_id].add(trip.gtfs_trip_id);
|
|
144
96
|
}
|
|
145
|
-
// save all new positions
|
|
146
|
-
yield this.positionsRepository.save(data.positions);
|
|
147
97
|
}
|
|
148
|
-
|
|
149
|
-
|
|
98
|
+
// Get cached schedule for each unique block_id
|
|
99
|
+
const blockIdToTripStopScheduleDict = yield Object.entries(blockIdToTripIdsDict).reduce((acc, [blockId, gtfsTripIds]) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const tripStops = yield acc;
|
|
101
|
+
try {
|
|
102
|
+
const schedule = yield this.tripStopsManager.setAndReturnTripStopsSchedule(blockId, [...gtfsTripIds]);
|
|
103
|
+
tripStops[blockId] = schedule;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
helpers_1.IntegrationErrorHandler.handle(err);
|
|
107
|
+
}
|
|
108
|
+
return acc;
|
|
109
|
+
}), Promise.resolve({}));
|
|
110
|
+
// duplicate positions for trips with block_ids
|
|
111
|
+
for (const trip of data.updatedTrips) {
|
|
112
|
+
if (tripIdToPositionDict[trip.id]) {
|
|
113
|
+
if (trip.gtfs_block_id) {
|
|
114
|
+
// Determine current position tracking status
|
|
115
|
+
tripIdToPositionDict[trip.id].tracking = VPUtils_1.VPUtils.determineTrackingStatus(trip.gtfs_trip_id, blockIdToTripStopScheduleDict[trip.gtfs_block_id], tripIdToPositionDict[trip.id]);
|
|
116
|
+
}
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const currentPosition = data.positions.find((position) => {
|
|
120
|
+
return position.trips_id === tripsIdsByBlockIds[trip.gtfs_block_id];
|
|
121
|
+
});
|
|
122
|
+
if (!currentPosition) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
// Determine position duplication and new position tracking status
|
|
126
|
+
const newPositionTrackingStatus = VPUtils_1.VPUtils.determineNewPositionTracking(blockIdToTripStopScheduleDict[trip.gtfs_block_id], trip, currentPosition);
|
|
127
|
+
// duplicate position with new created trip for second trip
|
|
128
|
+
const newPosition = Object.assign({}, currentPosition);
|
|
129
|
+
newPosition.trips_id = trip.id;
|
|
130
|
+
newPosition.tracking = newPositionTrackingStatus;
|
|
131
|
+
data.positions.push(newPosition);
|
|
150
132
|
}
|
|
133
|
+
// save all new positions
|
|
134
|
+
yield this.positionsRepository.save(data.positions);
|
|
151
135
|
}
|
|
152
136
|
if (((_b = data.updatedTrips) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
153
|
-
const tripsSpan = (0, trace_provider_1.createChildSpan)("Task.UpdateDelay.updatedTrips");
|
|
154
|
-
tripsSpan === null || tripsSpan === void 0 ? void 0 : tripsSpan.setAttribute("updatedTrips", data.updatedTrips.length);
|
|
155
137
|
try {
|
|
156
138
|
// Get all positions for each trip
|
|
157
139
|
const tripsPositionsToUpdate = yield this.positionsRepository.getPositionsForUpdateDelay(tripIds);
|
|
@@ -192,9 +174,6 @@ class UpdateDelayTask extends workers_1.AbstractTask {
|
|
|
192
174
|
catch (err) {
|
|
193
175
|
throw new golemio_errors_1.GeneralError(`Error while updating delay. For trip ids:${tripIds.slice(0, 10).join(",")}`, this.constructor.name, err);
|
|
194
176
|
}
|
|
195
|
-
finally {
|
|
196
|
-
tripsSpan === null || tripsSpan === void 0 ? void 0 : tripsSpan.end();
|
|
197
|
-
}
|
|
198
177
|
}
|
|
199
178
|
});
|
|
200
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateDelayTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4FAAiF;AACjF,oFAAyE;AACzE,oEAA8G;AAC9G,2EAA6F;AAC7F,2FAAqF;AACrF,2EAA6E;AAC7E,6EAAwE;AACxE,4EAAyF;AACzF,oEAAiE;AACjE,gFAA6E;AAC7E,mFAA2D;AAC3D,kEAA+D;AAC/D,gDAA6C;AAU7C,mEAA0E;
|
|
1
|
+
{"version":3,"file":"UpdateDelayTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4FAAiF;AACjF,oFAAyE;AACzE,oEAA8G;AAC9G,2EAA6F;AAC7F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