Compare commits

...

5 Commits

Author SHA1 Message Date
Frank a6cee985e9 refactor(stats): fall through to partial sync 2026-08-09 14:39:14 +00:00
Frank 3d73360e06 refactor(stats): simplify full sync check 2026-08-09 14:15:15 +00:00
Frank 8e1dd8b757 refactor(stats): inline sync fallback 2026-08-09 14:09:05 +00:00
Jay 21acab0565 test(stats): remove sync fallback coverage 2026-08-09 14:01:21 +00:00
Jay 1090d72ea2 fix(stats): fall back after full sync failure 2026-08-09 13:59:59 +00:00
+13 -3
View File
@@ -19,9 +19,19 @@ const daemon = Effect.gen(function* () {
let lastFullDay = ""
const pass = Effect.gen(function* () {
const today = new Date().toISOString().slice(0, 10)
const full = lastFullDay !== today
yield* syncStats({ full })
if (full) lastFullDay = today
if (lastFullDay !== today) {
const completed = yield* syncStats({ full: true }).pipe(
Effect.as(true),
Effect.catchCause((cause) =>
Effect.logWarning(`full stats sync failed; falling back to incremental sync ${Cause.pretty(cause)}`).pipe(
Effect.as(false),
),
),
)
lastFullDay = today
if (completed) return
}
yield* syncStats({ full: false })
}).pipe(
Effect.catchCause((cause) =>
Effect.logWarning(`stats sync failed ${JSON.stringify({ cause: Cause.pretty(cause) })}`),