Catch client.query calls
This commit is contained in:
parent
8d6f8e7d8d
commit
491c3f5125
|
@ -82,9 +82,13 @@ class Optimizer implements NStore {
|
|||
|
||||
// Finally, query the client.
|
||||
this.#debug('Querying client...');
|
||||
for (const clientEvent of await this.#client.query(filters, opts)) {
|
||||
results.add(clientEvent);
|
||||
if (results.size >= limit) return getResults();
|
||||
try {
|
||||
for (const clientEvent of await this.#client.query(filters, opts)) {
|
||||
results.add(clientEvent);
|
||||
if (results.size >= limit) return getResults();
|
||||
}
|
||||
} catch (_e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/** Get return type from map. */
|
||||
|
|
|
@ -64,10 +64,14 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: NostrEvent)
|
|||
if (wantedAuthors.size) filters.push({ kinds: [0], authors: [...wantedAuthors] });
|
||||
|
||||
if (filters.length) {
|
||||
const events = await client.query(filters, { signal: AbortSignal.timeout(timeout) });
|
||||
try {
|
||||
const events = await client.query(filters, { signal: AbortSignal.timeout(timeout) });
|
||||
|
||||
for (const event of events) {
|
||||
this.event(event);
|
||||
for (const event of events) {
|
||||
this.event(event);
|
||||
}
|
||||
} catch (_e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue