events-backend: fix event bus notify timeout

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-05-24 17:08:57 +02:00
parent d17ce45a4a
commit ed1499b349
@@ -141,6 +141,11 @@ export async function createEventBusRouter(options: {
notify(204);
controller.abort();
}, notifyTimeoutMs);
shouldNotifyPromise.then(shouldNotify => {
if (!shouldNotify) {
clearTimeout(timeout);
}
});
try {
const { events } = await store.readSubscription(id);
@@ -156,7 +161,6 @@ export async function createEventBusRouter(options: {
resolveShouldNotify!(true);
}
} finally {
clearTimeout(timeout);
resolveShouldNotify!(false);
}
},