fix: parallelize push notifications and force high priority (resolves #206) - #215
Merged
Conversation
…206) Why: - Sentry and Break-in alerts were suffering from up to 20-30 minutes delays on iOS and Android because notifications were sent with `priority: 'default'`. Apple's APNs and Google's FCM delay normal-priority notifications to conserve battery (Doze mode). - The alert processing handler was also experiencing artificial latencies because it executed Telegram and Push notifications sequentially, taking over 1000ms combined. - The `[TELEGRAM_SLOW]` telemetry metric incorrectly included the Push API latency, masking the real bottleneck. - Frequent normal network fluctuations caused false-positive `DELAYED` logs due to an overly aggressive 1000ms threshold. How: - Forced `priority: 'high'` in the Expo Push payload for all notifications to guarantee immediate delivery and wake up sleeping devices. - Parallelized the Telegram and Push API calls using `Promise.all()` in `VehicleAlertNotifierService` to divide network wait times by two. - Isolated the `telegramTime` measurement to only track the Telegram API call, ensuring accurate metrics. - Increased the `isProcessingDelayed` threshold from 1000ms to 3000ms in `vehicle-alert-notifier.service.ts` to accommodate normal third-party API latency. - Added `[EXPO_PUSH_LATENCY]` telemetry logs with the correlation ID to trace push API performance.
JordiMa
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #206
Why:
priority: 'default'. Apple's APNs and Google's FCM delay normal-priority notifications to conserve battery (Doze mode).[TELEGRAM_SLOW]telemetry metric incorrectly included the Push API latency, masking the real bottleneck.DELAYEDlogs due to an overly aggressive 1000ms threshold.How:
priority: 'high'in the Expo Push payload for all notifications to guarantee immediate delivery and wake up sleeping devices.Promise.all()inVehicleAlertNotifierServiceto divide network wait times by two.telegramTimemeasurement to only track the Telegram API call, ensuring accurate metrics.isProcessingDelayedthreshold from 1000ms to 3000ms invehicle-alert-notifier.service.tsto accommodate normal third-party API latency.[EXPO_PUSH_LATENCY]telemetry logs with the correlation ID to trace push API performance.