events-backend: fix check for already consumed events

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-05-25 08:41:04 +02:00
parent c6e8726543
commit c38913a093
@@ -339,9 +339,9 @@ export class DatabaseEventBusStore implements EventBusStore {
this.#db.ref('topics').withSchema('sub').wrap('ANY(', ')'),
)
// Skip events that have already been consumed by this subscription
.where(
.whereNot(
this.#db.raw('?', id),
'<>',
'=',
this.#db.ref('consumed_by').withSchema('event').wrap('ANY(', ')'),
)
.where('event.id', '>', this.#db.ref('read_until').withSchema('sub'))