Reqmeister: timeout -> signal

This commit is contained in:
Alex Gleason 2023-12-23 11:16:18 -06:00
parent 17cef2f186
commit 04925a580b
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import { Time } from '@/utils/time.ts';
const reqmeister = new Reqmeister({
delay: Time.seconds(1),
timeout: Time.seconds(1),
signal: AbortSignal.timeout(Time.seconds(1)),
});
export { reqmeister };

View File

@ -6,7 +6,7 @@ import { eventToMicroFilter, getFilterId, type MicroFilter } from '@/filter.ts';
interface ReqmeisterOpts {
delay?: number;
timeout?: number;
signal?: AbortSignal;
}
type ReqmeisterQueueItem = [string, MicroFilter, WebSocket['url'][]];
@ -55,7 +55,7 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: Event) => an
if (wantedEvents.size) filters.push({ ids: [...wantedEvents] });
if (wantedAuthors.size) filters.push({ kinds: [0], authors: [...wantedAuthors] });
const events = await client.getFilters(filters, { timeout: this.#opts.timeout });
const events = await client.getFilters(filters, { signal: this.#opts.signal });
for (const event of events) {
this.encounter(event);