add event ids from q.feed.takeSnapshot() to filter.not
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
1f90b2fe90
commit
148acc764c
@ -31,7 +31,12 @@ export const SnortPubKey = "npub1sn0rtcjcf543gj4wsg7fa59s700d5ztys5ctj0g69g2x680
|
|||||||
/**
|
/**
|
||||||
* Default search relays
|
* Default search relays
|
||||||
*/
|
*/
|
||||||
export const SearchRelays = ["wss://relay.nostr.band", "wss://search.nos.today", "wss://relay.noswhere.com", "wss://saltivka.org"];
|
export const SearchRelays = [
|
||||||
|
"wss://relay.nostr.band",
|
||||||
|
"wss://search.nos.today",
|
||||||
|
"wss://relay.noswhere.com",
|
||||||
|
"wss://saltivka.org",
|
||||||
|
];
|
||||||
|
|
||||||
export const DeveloperAccounts = [
|
export const DeveloperAccounts = [
|
||||||
"63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed", // kieran
|
"63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed", // kieran
|
||||||
|
@ -122,6 +122,20 @@ export class QueryManager extends EventEmitter<QueryManagerEvents> {
|
|||||||
}
|
}
|
||||||
qSend.filters = fNew;
|
qSend.filters = fNew;
|
||||||
|
|
||||||
|
const alreadyHave = new Set<string>();
|
||||||
|
qSend.filters.forEach(f => {
|
||||||
|
// check what we already have locally
|
||||||
|
q.feed.takeSnapshot().forEach(e => alreadyHave.add(e.id));
|
||||||
|
if (alreadyHave.size) {
|
||||||
|
f.not = f.not || {};
|
||||||
|
f.not.ids = f.not.ids || [];
|
||||||
|
// if there's multiple filters in the query, should we only add alreadyHave events that actually match the filter?
|
||||||
|
f.not.ids.push(...alreadyHave);
|
||||||
|
console.log("already have", f, alreadyHave);
|
||||||
|
}
|
||||||
|
// query relays one at a time at intervals, updating alreadyHave in between?
|
||||||
|
});
|
||||||
|
|
||||||
if (qSend.relay) {
|
if (qSend.relay) {
|
||||||
this.#log("Sending query to %s %s %O", qSend.relay, q.id, qSend);
|
this.#log("Sending query to %s %s %O", qSend.relay, q.id, qSend);
|
||||||
const s = this.#system.pool.getConnection(qSend.relay);
|
const s = this.#system.pool.getConnection(qSend.relay);
|
||||||
|
Loading…
Reference in New Issue
Block a user