From 1f8d4bfbd4d0521a61b2d4fe1e1c450c6e099d1b Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 25 Mar 2025 15:11:47 -0700 Subject: [PATCH] extract tuple.toString to variable --- src/notifications/schedulers/ETANotificationScheduler.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/notifications/schedulers/ETANotificationScheduler.ts b/src/notifications/schedulers/ETANotificationScheduler.ts index 76c6027..4e0227a 100644 --- a/src/notifications/schedulers/ETANotificationScheduler.ts +++ b/src/notifications/schedulers/ETANotificationScheduler.ts @@ -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(); - 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] }); }