Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/stats/core/src/athena.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Effect, Layer } from "effect"
import * as Context from "effect/Context"
import { Resource } from "sst/resource"

const ATHENA_MAX_POLL_ATTEMPTS = 300
const ATHENA_MAX_POLL_ATTEMPTS = 900
const ATHENA_PAGE_SIZE = 1000

export type AthenaData = Record<string, string>
Expand Down
16 changes: 13 additions & 3 deletions packages/stats/server/src/stat-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) })}`),
Expand Down
Loading