mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
extract tuple.toString to variable
This commit is contained in:
@@ -75,12 +75,13 @@ export class ETANotificationScheduler {
|
||||
|
||||
private async etaSubscriberCallback(eta: IEta) {
|
||||
const tuple = new TupleKey(eta.shuttleId, eta.stopId);
|
||||
if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) {
|
||||
const tupleKey = tuple.toString();
|
||||
if (this.deviceIdsToDeliverTo[tupleKey] === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const deviceIdsToRemove = new Set<string>();
|
||||
for (let deviceId of Object.keys(this.deviceIdsToDeliverTo[tuple.toString()])) {
|
||||
for (let deviceId of Object.keys(this.deviceIdsToDeliverTo[tupleKey])) {
|
||||
const deliveredSuccessfully = await this.sendEtaNotificationImmediatelyIfSecondsRemainingBelowThreshold(deviceId, eta);
|
||||
if (deliveredSuccessfully) {
|
||||
deviceIdsToRemove.add(deviceId);
|
||||
@@ -88,7 +89,7 @@ export class ETANotificationScheduler {
|
||||
}
|
||||
|
||||
deviceIdsToRemove.forEach((deviceId) => {
|
||||
delete this.deviceIdsToDeliverTo[tuple.toString()][deviceId]
|
||||
delete this.deviceIdsToDeliverTo[tupleKey][deviceId]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user