This commit is contained in:
2023-09-08 17:25:36 +01:00
parent 08bc4cafa9
commit 3e0fae2c33
15 changed files with 1156 additions and 148 deletions

View File

@ -4,9 +4,7 @@ import { unixNowMs, unwrap } from "@snort/shared";
import { Connection, ReqFilter, Nips, TaggedNostrEvent } from ".";
import { NoteStore } from "./note-collection";
import { flatMerge } from "./request-merger";
import { BuiltRawReqFilter } from "./request-builder";
import { FlatReqFilter, expandFilter } from "./request-expander";
import { eventMatchesFilter } from "./request-matcher";
/**
@ -19,7 +17,6 @@ class QueryTrace {
eose?: number;
close?: number;
#wasForceClosed = false;
readonly flatFilters: Array<FlatReqFilter>;
readonly #fnClose: (id: string) => void;
readonly #fnProgress: () => void;
@ -34,7 +31,6 @@ class QueryTrace {
this.start = unixNowMs();
this.#fnClose = fnClose;
this.#fnProgress = fnProgress;
this.flatFilters = filters.flatMap(expandFilter);
}
sentToRelay() {
@ -166,11 +162,7 @@ export class Query implements QueryBase {
* Recompute the complete set of compressed filters from all query traces
*/
get filters() {
return flatMerge(this.flatFilters);
}
get flatFilters() {
return this.#tracing.flatMap(a => a.flatFilters);
return this.#tracing.flatMap(a => a.filters);
}
get feed() {