refactor(stats): fall through to partial sync

This commit is contained in:
Frank
2026-08-09 14:39:14 +00:00
parent 3d73360e06
commit a6cee985e9
+12 -11
View File
@@ -19,18 +19,19 @@ const daemon = Effect.gen(function* () {
let lastFullDay = ""
const pass = Effect.gen(function* () {
const today = new Date().toISOString().slice(0, 10)
if (lastFullDay === today) return yield* syncStats({ full: false })
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),
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),
),
),
),
)
if (!completed) yield* syncStats({ full: false })
lastFullDay = today
)
lastFullDay = today
if (completed) return
}
yield* syncStats({ full: false })
}).pipe(
Effect.catchCause((cause) =>
Effect.logWarning(`stats sync failed ${JSON.stringify({ cause: Cause.pretty(cause) })}`),