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,14 +35,16 @@ for await (const { pubkey } of statsQuery.stream(10)) {
start = createdAt; start = createdAt;
} }
await kysely if (start && end) {
.updateTable('author_stats') await kysely
.set({ .updateTable('author_stats')
streak_end: end, .set({
streak_start: start, streak_end: end,
}) streak_start: start,
.where('pubkey', '=', pubkey) })
.execute(); .where('pubkey', '=', pubkey)
.execute();
}
} }
Deno.exit(); Deno.exit();