extract tuple.toString to variable

This commit is contained in:
2025-03-25 15:11:47 -07:00
parent 50636e5582
commit 1f8d4bfbd4

View File

@@ -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]
});
}