mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Reduce timeouts
This commit is contained in:
parent
c3ffe7c7f7
commit
092a20088a
2 changed files with 6 additions and 6 deletions
|
|
@ -73,7 +73,7 @@ function connectStream(socket: WebSocket) {
|
|||
const pubsub = await Storages.pubsub();
|
||||
|
||||
try {
|
||||
for (const event of await store.query(filters, { limit: FILTER_LIMIT, timeout: 500 })) {
|
||||
for (const event of await store.query(filters, { limit: FILTER_LIMIT, timeout: 300 })) {
|
||||
send(['EVENT', subId, event]);
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -128,7 +128,7 @@ function connectStream(socket: WebSocket) {
|
|||
/** Handle COUNT. Return the number of events matching the filters. */
|
||||
async function handleCount([_, subId, ...filters]: NostrClientCOUNT): Promise<void> {
|
||||
const store = await Storages.db();
|
||||
const { count } = await store.count(filters, { timeout: 500 });
|
||||
const { count } = await store.count(filters, { timeout: 100 });
|
||||
send(['COUNT', subId, { count, approximate: false }]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class EventsDB implements NStore {
|
|||
await this.deleteEventsAdmin(event);
|
||||
|
||||
try {
|
||||
await this.store.event(event, { ...opts, timeout: opts.timeout ?? 3000 });
|
||||
await this.store.event(event, { ...opts, timeout: opts.timeout ?? 1000 });
|
||||
} catch (e) {
|
||||
if (e.message === 'Cannot add a deleted event') {
|
||||
throw new RelayError('blocked', 'event deleted by user');
|
||||
|
|
@ -163,7 +163,7 @@ class EventsDB implements NStore {
|
|||
|
||||
this.console.debug('REQ', JSON.stringify(filters));
|
||||
|
||||
return this.store.query(filters, { ...opts, timeout: opts.timeout ?? 3000 });
|
||||
return this.store.query(filters, { ...opts, timeout: opts.timeout ?? 1000 });
|
||||
}
|
||||
|
||||
/** Delete events based on filters from the database. */
|
||||
|
|
@ -171,7 +171,7 @@ class EventsDB implements NStore {
|
|||
if (!filters.length) return Promise.resolve();
|
||||
this.console.debug('DELETE', JSON.stringify(filters));
|
||||
|
||||
return this.store.remove(filters, { ...opts, timeout: opts.timeout ?? 5000 });
|
||||
return this.store.remove(filters, { ...opts, timeout: opts.timeout ?? 3000 });
|
||||
}
|
||||
|
||||
/** Get number of events that would be returned by filters. */
|
||||
|
|
@ -184,7 +184,7 @@ class EventsDB implements NStore {
|
|||
|
||||
this.console.debug('COUNT', JSON.stringify(filters));
|
||||
|
||||
return this.store.count(filters, { ...opts, timeout: opts.timeout ?? 1000 });
|
||||
return this.store.count(filters, { ...opts, timeout: opts.timeout ?? 500 });
|
||||
}
|
||||
|
||||
/** Return only the tags that should be indexed. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue