mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
db/relays: skip if values are empty
This commit is contained in:
parent
e3ade42f58
commit
b11677573b
1 changed files with 1 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import { db } from '@/db.ts';
|
||||||
|
|
||||||
/** Inserts relays into the database, skipping duplicates. */
|
/** Inserts relays into the database, skipping duplicates. */
|
||||||
function addRelays(relays: `wss://${string}`[]) {
|
function addRelays(relays: `wss://${string}`[]) {
|
||||||
|
if (!relays.length) return Promise.resolve();
|
||||||
const values = relays.map((url) => ({ url }));
|
const values = relays.map((url) => ({ url }));
|
||||||
|
|
||||||
return db.insertInto('relays')
|
return db.insertInto('relays')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue