hydrateEvents: early return is only needed for stats?
This commit is contained in:
parent
a2c3daade7
commit
1f5ba81e98
|
@ -99,10 +99,6 @@ function gatherReposts({ events, storage, signal }: HydrateOpts): Promise<DittoE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ids.size) {
|
|
||||||
return Promise.resolve([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return storage.query(
|
return storage.query(
|
||||||
[{ ids: [...ids], limit: ids.size }],
|
[{ ids: [...ids], limit: ids.size }],
|
||||||
{ signal },
|
{ signal },
|
||||||
|
@ -122,10 +118,6 @@ function gatherQuotes({ events, storage, signal }: HydrateOpts): Promise<DittoEv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ids.size) {
|
|
||||||
return Promise.resolve([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return storage.query(
|
return storage.query(
|
||||||
[{ ids: [...ids], limit: ids.size }],
|
[{ ids: [...ids], limit: ids.size }],
|
||||||
{ signal },
|
{ signal },
|
||||||
|
@ -136,10 +128,6 @@ function gatherQuotes({ events, storage, signal }: HydrateOpts): Promise<DittoEv
|
||||||
function gatherAuthors({ events, storage, signal }: HydrateOpts): Promise<DittoEvent[]> {
|
function gatherAuthors({ events, storage, signal }: HydrateOpts): Promise<DittoEvent[]> {
|
||||||
const pubkeys = new Set(events.map((event) => event.pubkey));
|
const pubkeys = new Set(events.map((event) => event.pubkey));
|
||||||
|
|
||||||
if (!pubkeys.size) {
|
|
||||||
return Promise.resolve([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return storage.query(
|
return storage.query(
|
||||||
[{ kinds: [0], authors: [...pubkeys], limit: pubkeys.size }],
|
[{ kinds: [0], authors: [...pubkeys], limit: pubkeys.size }],
|
||||||
{ signal },
|
{ signal },
|
||||||
|
@ -150,10 +138,6 @@ function gatherAuthors({ events, storage, signal }: HydrateOpts): Promise<DittoE
|
||||||
function gatherUsers({ events, storage, signal }: HydrateOpts): Promise<DittoEvent[]> {
|
function gatherUsers({ events, storage, signal }: HydrateOpts): Promise<DittoEvent[]> {
|
||||||
const pubkeys = new Set(events.map((event) => event.pubkey));
|
const pubkeys = new Set(events.map((event) => event.pubkey));
|
||||||
|
|
||||||
if (!pubkeys.size) {
|
|
||||||
return Promise.resolve([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return storage.query(
|
return storage.query(
|
||||||
[{ kinds: [30361], authors: [Conf.pubkey], '#d': [...pubkeys], limit: pubkeys.size }],
|
[{ kinds: [30361], authors: [Conf.pubkey], '#d': [...pubkeys], limit: pubkeys.size }],
|
||||||
{ signal },
|
{ signal },
|
||||||
|
|
Loading…
Reference in New Issue