db/events: respect the signal

This commit is contained in:
Alex Gleason 2023-12-31 21:01:30 -06:00
parent f665c5f825
commit e341ec7b36
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 1 additions and 0 deletions

View File

@ -257,6 +257,7 @@ async function getEvents<K extends number>(
filters: DittoFilter<K>[], filters: DittoFilter<K>[],
opts: GetEventsOpts = {}, opts: GetEventsOpts = {},
): Promise<DittoEvent<K>[]> { ): Promise<DittoEvent<K>[]> {
if (opts.signal?.aborted) return Promise.resolve([]);
if (!filters.length) return Promise.resolve([]); if (!filters.length) return Promise.resolve([]);
debug('REQ', JSON.stringify(filters)); debug('REQ', JSON.stringify(filters));
let query = getEventsQuery(filters); let query = getEventsQuery(filters);