1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-26 21:25:18 +01:00

Merge pull request #759 from nimbleghost/fix-race-condition

Fix account sync race condition
This commit is contained in:
Philipp C. Heckel 2023-05-31 14:21:14 -04:00 committed by GitHub
commit 953efbee47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,6 +47,13 @@ export const useConnectionListeners = (account, subscriptions, users) => {
const handleMessage = async (subscriptionId, message) => { const handleMessage = async (subscriptionId, message) => {
const subscription = await subscriptionManager.get(subscriptionId); const subscription = await subscriptionManager.get(subscriptionId);
// Race condition: sometimes the subscription is already unsubscribed from account
// sync before the message is handled
if (!subscription) {
return;
}
if (subscription.internal) { if (subscription.internal) {
await handleInternalMessage(message); await handleInternalMessage(message);
} else { } else {