graph/db+sqldb: use batch validation for node migration

Restructue the `migrateNodes` function so that it does the validation of
migrated nodes in batches. So instead of fetching each node individually
after migrating it, we wait for a minimum batch size to be reached and
then validate a batch of nodes together. This lets us make way fewer DB
round trips.
This commit is contained in:
Elle Mouton
2025-08-13 13:07:11 +02:00
parent 218aa9eaa8
commit 03ef2740a6
5 changed files with 176 additions and 47 deletions

View File

@@ -21,6 +21,11 @@ WHERE graph_nodes.last_update IS NULL
OR EXCLUDED.last_update > graph_nodes.last_update
RETURNING id;
-- name: GetNodesByIDs :many
SELECT *
FROM graph_nodes
WHERE id IN (sqlc.slice('ids')/*SLICE:ids*/);
-- name: GetNodeByPubKey :one
SELECT *
FROM graph_nodes