mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-23 03:43:47 +01:00
Fix account sync race condition
This commit is contained in:
parent
b222541ea8
commit
453bf435b0
1 changed files with 7 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue