mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-25 14:17:31 +00:00
fix(plugins): handle a failed addon read while an earlier trip event still waits
The addon read of a queued plugin event now settles to off on its own, so a rejection that comes before the earlier event's turn can no longer go unhandled and stop the server.
This commit is contained in:
@@ -49,7 +49,7 @@ export function tripEventSink(addons: AddonsService, orm: MikroORM | undefined,
|
||||
const before = queues.get(tripId);
|
||||
if (!addonId && !before) return deliver(tripId, event, meta);
|
||||
const ask = () => (addonId ? addons.isEnabledForTrip(tripId, addonId) : Promise.resolve(true));
|
||||
const on = orm && addonId ? withRequestContext(orm, ask) : ask();
|
||||
const on = (orm && addonId ? withRequestContext(orm, ask) : ask()).catch(() => false);
|
||||
const queued = (before ?? Promise.resolve())
|
||||
.then(() => on)
|
||||
.then((open) => {
|
||||
|
||||
Reference in New Issue
Block a user