db/relays: skip if values are empty
This commit is contained in:
parent
e3ade42f58
commit
b11677573b
|
@ -2,6 +2,7 @@ import { db } from '@/db.ts';
|
|||
|
||||
/** Inserts relays into the database, skipping duplicates. */
|
||||
function addRelays(relays: `wss://${string}`[]) {
|
||||
if (!relays.length) return Promise.resolve();
|
||||
const values = relays.map((url) => ({ url }));
|
||||
|
||||
return db.insertInto('relays')
|
||||
|
|
Loading…
Reference in New Issue