Repository navigation
fix(feed-sync): real finish times, so Run History duration is not 0 s (SYNC-1) - #190
Merged
Merged
Conversation
…ot 0 s
finalize_log and touch_last_run wrote func.now(). In Postgres now() is the
start of the current transaction, and the whole import runs in one
transaction, so finished_at, last_run_at and last_success_at recorded the
moment the import began. Every run on Test showed 0.03-0.25 s ("Duration
0 s"): for a file upload that is only the Excel parse, for Sync now only the
Celery queue wait.
Use func.clock_timestamp() (the time the statement runs, same database clock
as started_at). started_at and the crash/stale UPDATEs keep now(): they run
at the start of their own short transaction. No migration; old rows keep
their old values.
Tested: tests/unit (only the 4 known S3-mock failures); a real-Postgres test
(create_log, commit, 1.2 s of work in the next transaction, finalize_log)
gives >= 1.2 s with the fix and 0.003 s without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
satishbagali
enabled auto-merge
December 4, 2026 06:06
Aiyappa-DigitalGreen
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every feed sync and file upload shows "Duration 0 s" in Admin › Feed Library Sync › Run History. The admins' sync e-mail also shows Finished = Started.
Cause:
finalize_logandtouch_last_runwrotefunc.now().now()is the start of the current transaction.finished_at,last_run_atandlast_success_atrecorded the moment the import began, not when it ended.Evidence on Test (read-only,
feed_sync_log): 20 of 21 finished runs lasted 0.03–0.25 s.What the shown number really measured:
Change
backend/repositories/feed_sync_repository.pyfinished_at,last_run_at,last_success_atusefunc.clock_timestamp(), the time the statement runsstarted_at.started_at(server defaultnow()).UPDATEs. Each runs in its own short transaction, so its time is already right.finished_atkeeps its meaning, now correct)Tests
tests/unitfinalize_log/touch_last_runassignclock_timestamp()create_log→ commit → 1.2 s of work in the next transaction →finalize_log→ committests/integration/test_schema_alignment.pyAfter the deploy: upload the Test feed export. Run History should show the real seconds.
🤖 Generated with Claude Code