events-backend: fix error when reading subscription with empty events table

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-05-27 13:34:02 +02:00
parent 692c505a38
commit a19caf2697
2 changed files with 2 additions and 2 deletions
@@ -379,7 +379,7 @@ describe('eventsPlugin', () => {
await helper.subscribe('tester', ['test']).expect(201);
jest.useFakeTimers({
doNotFake: ['nextTick'],
advanceTimers: true,
});
try {
@@ -447,7 +447,7 @@ export class DatabaseEventBusStore implements EventBusStore {
// events where read, the last ID out of all events
.update({
read_until: this.#db.raw(
'COALESCE(last_event_id, (SELECT MAX(id) FROM event_bus_events))',
'COALESCE(last_event_id, (SELECT MAX(id) FROM event_bus_events), 0)',
),
})
.updateFrom({