mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 06:40:50 +00:00
fix(strava): resume an unfinished backfill where the last run stopped
One run reads at most forty pages of a hundred activities. A longer history ended as incomplete with no note of how far it got, so every boot read the same newest pages again, spent up to 190 of the instance's 200 requests per fifteen minutes on them, and never reached the older activities. The run now records the start of the oldest activity it read and sends the next run for after the rate window; that run asks Strava for the activities before it. A run that gets no further records nothing and sends nothing. The place is cleared when the backfill completes.
This commit is contained in:
1 parent
456976175b
commit
34eea153a8
10 files changed
+289
-53
No files matched your search
@@ -0,0 +1,12 @@
|
||||
-- Where an unfinished Strava backfill picks up.
|
||||
--
|
||||
-- One backfill run reads at most forty pages of a hundred activities. A
|
||||
-- longer history ended the run as incomplete without a note of how far it
|
||||
-- got, so every boot read the same newest forty pages again, up to 190 of
|
||||
-- the 200 requests the whole instance may make in fifteen minutes, and the
|
||||
-- older history was never reached. The column holds the start of the oldest
|
||||
-- activity the last run read; the next run asks for activities before it.
|
||||
-- Nullable and unset for every existing row: an unfinished backfill starts
|
||||
-- once more from the newest page and records its place from then on.
|
||||
|
||||
ALTER TABLE "users" ADD COLUMN "strava_backfill_resume_before" TIMESTAMP(3);
|
||||
@@ -316,6 +316,11 @@ model User {
|
||||
// First-connect full-history backfill marker (self-converging discovery
|
||||
// predicate `strava_backfill_completed_at IS NULL`), mirroring WHOOP/Fitbit.
|
||||
stravaBackfillCompletedAt DateTime? @map("strava_backfill_completed_at")
|
||||
// Where an unfinished backfill picks up: the start of the oldest activity
|
||||
// the last run read. A history longer than one run's page ceiling is read
|
||||
// in runs that each walk further back from here, instead of every run
|
||||
// starting again at the newest page. Cleared when the backfill completes.
|
||||
stravaBackfillResumeBefore DateTime? @map("strava_backfill_resume_before")
|
||||
|
||||
// Locale (null = use system/admin default)
|
||||
locale String? @map("locale") // "de" | "en" | null
|
||||
|
||||
Reference in new issue
Block a user