streak-recompute: only update changed rows

This commit is contained in:
Alex Gleason 2025-02-06 16:04:25 -06:00
parent 08a5e7f761
commit 30559ba043
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -35,6 +35,7 @@ for await (const { pubkey } of statsQuery.stream(10)) {
start = createdAt; start = createdAt;
} }
if (start && end) {
await kysely await kysely
.updateTable('author_stats') .updateTable('author_stats')
.set({ .set({
@ -43,6 +44,7 @@ for await (const { pubkey } of statsQuery.stream(10)) {
}) })
.where('pubkey', '=', pubkey) .where('pubkey', '=', pubkey)
.execute(); .execute();
}
} }
Deno.exit(); Deno.exit();