add pseudocode

This commit is contained in:
2025-02-02 21:24:40 -08:00
parent 6172a04427
commit fe233dfcbd

View File

@@ -56,6 +56,15 @@ export class NotificationService {
return this._lastRefreshedTimeMs && Date.now() - this._lastRefreshedTimeMs < thirtyMinutesMs; return this._lastRefreshedTimeMs && Date.now() - this._lastRefreshedTimeMs < thirtyMinutesMs;
} }
private sendEtaNotificationImmediately({ deviceId, shuttleId, stopId }: ScheduledNotificationData) {
// Construct the fetch request
// Send the fetch request
// Check whether it was successful
// Return the result
}
/** /**
* Queue a notification to be sent. * Queue a notification to be sent.
* @param deviceId The device ID to send the notification to. * @param deviceId The device ID to send the notification to.
@@ -63,7 +72,13 @@ export class NotificationService {
* @param stopId Stop ID of ETA object to check. * @param stopId Stop ID of ETA object to check.
*/ */
public async scheduleNotification({ deviceId, shuttleId, stopId }: ScheduledNotificationData) { public async scheduleNotification({ deviceId, shuttleId, stopId }: ScheduledNotificationData) {
// Associate TupleKey(shuttleId, stopId) with array of device IDs
// Refresh the subscriber with the updated array if needed
// In the subscriber callback:
// If the ETA matches, call sendNotification with the necessary parameters
// If it was successful, unsubscribe the callback
// If it wasn't, leave it until the next ETA update
} }
/** /**