feat: tools pages

Various other fixes:
- Better handeling of limit/since/before merging
- Expose timeout through request builder
- Expose PickN through request builder
- Fix tests
This commit is contained in:
2023-12-20 14:07:51 +00:00
parent 96368d4a2b
commit 06b7dcad11
21 changed files with 526 additions and 156 deletions

View File

@ -157,14 +157,20 @@ export class Query extends EventEmitter<QueryEvents> implements QueryBase {
*/
#feed: NoteStore;
/**
* Maximum waiting time for this query
*/
#timeout: number;
#log = debug("Query");
constructor(id: string, instance: string, feed: NoteStore, leaveOpen?: boolean) {
constructor(id: string, instance: string, feed: NoteStore, leaveOpen?: boolean, timeout?: number) {
super();
this.id = id;
this.#feed = feed;
this.fromInstance = instance;
this.#leaveOpen = leaveOpen ?? false;
this.#timeout = timeout ?? 5_000;
this.#checkTraces();
}
@ -292,7 +298,7 @@ export class Query extends EventEmitter<QueryEvents> implements QueryBase {
this.#stopCheckTraces();
this.#checkTrace = setInterval(() => {
for (const v of this.#tracing) {
if (v.runtime > 5_000 && !v.finished) {
if (v.runtime > this.#timeout && !v.finished) {
v.forceEose();
}
}