Repository navigation
Claim sync tasks atomically - #20
Conversation
|
@hxu I think the diagnosis here is real, but this PR does not complete the fix yet. The current producer path still does “read a task” and “mark it in progress” as two separate operations:
That means the new claim helper added in A concrete failure trace still looks like this: For activity page tasks this can fan out: Because What “done” should guarantee from the outside: Minimum fix: wire Better fix: move the claim all the way into One more follow-through: the PR body says active task details are exposed for status reporting, but |
|
@vicentereig I've had my agent address the concern and then in a new context did a review too, which found another issue around multiple sync processes that I've also addressed as well. Normally I would try to understand the code a bit more but unfortunately have not had the time 😅 |
|
On the status, I think that's staged in a follow up PR, so once this is merged I'll open the additional PRs. |
|
I appreciate the time you are spending! wrt: the "code" - I usually focus more on running scenarios through it and looking at the traces. I ask the model to do that for me, reads the code and shows me traces or stdout. that helps understanding without relying on the code how the thing works or how it will work (including if necessary the unhappy paths). |
|
Thanks for the follow-up here. This addresses the main thing I called out in the first review: the producer now uses the claim path, and the claim is pushed down into SQLite with I did somewhat miss one scenario in my initial review: stale claims. The trace I have in mind is: So the remaining issue is not the first claim anymore. It is claim ownership after recovery. I’m going to merge this PR because it fixes the original race materially and moves the system forward. I’ll open a follow-up PR for the stale-claim ownership fix with a scenario test around the trace above. |
Why: parallel sync workers need to claim tasks without racing each other.
Example:
With multiple workers polling the same SQLite queue, claiming a task should be one atomic operation.
Changes: