fetch profiles separately from notes

This commit is contained in:
Siddharth Singh 2024-07-02 04:56:38 +05:30
parent a00db2f4c1
commit 5f0b1ffe79
No known key found for this signature in database

View file

@ -32,9 +32,11 @@ const importUsers = async (
await Promise.all(relays.map(async (relay) => {
if (!relay.startsWith('wss://')) console.error(`Invalid relay url ${relay}`);
const conn = new NRelay1(relay);
const kinds = [0, 3];
if (!profilesOnly) kinds.push(1);
const matched = await conn.query([{ kinds, authors, limit: 1000 }]);
const matched = [
...await conn.query([{ kinds: [0, 3], authors, limit: 1000 }]),
...(!profilesOnly ? [] : await conn.query([{ kinds: [1], authors, limit: 1000 }])),
];
await conn.close();
await Promise.all(
matched.map(async (event) => {