mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
streak-recompute: only update changed rows
This commit is contained in:
parent
08a5e7f761
commit
30559ba043
1 changed files with 10 additions and 8 deletions
|
|
@ -35,14 +35,16 @@ for await (const { pubkey } of statsQuery.stream(10)) {
|
|||
start = createdAt;
|
||||
}
|
||||
|
||||
await kysely
|
||||
.updateTable('author_stats')
|
||||
.set({
|
||||
streak_end: end,
|
||||
streak_start: start,
|
||||
})
|
||||
.where('pubkey', '=', pubkey)
|
||||
.execute();
|
||||
if (start && end) {
|
||||
await kysely
|
||||
.updateTable('author_stats')
|
||||
.set({
|
||||
streak_end: end,
|
||||
streak_start: start,
|
||||
})
|
||||
.where('pubkey', '=', pubkey)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Deno.exit();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue