Fix: Can't regenerate failed/expired ZIMs (#1036) #1059
+49
−5
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.
The bug had some minor issues :
Schedule existence check was using the wrong ID (s_id instead of builder_id) causing the code to think schedules didn't exist when they actually did , This led to 409 Conflict errors when trying to create "new" schedules
after fixing the ID issue , I hit a 405 Method Not Allowed error because the PATCH request was going to /v2/schedules instead of /v2/schedules/{schedule_name} . I have investigated The Zimfarm API requires the schedule name in the URL path
after fixing both API issues the request was made and the ZIM was created but download URLs were still broken because the task_id wasn't being updated properly when selection versions changed, and the version pointer (b_selection_zim_version) still pointed to the old selection
Changes made:
zimfarm.py : Use builder_id instead of s_id for schedule checks, and fix PATCH URL to include schedule name in the path
builder.py: Add three layer update logic (try current selection - - > try by schedule_id --> insert new) and update b_selection_zim_version to point to current selection when requesting ZIMs
I have tested this locally , by reproducing the same issue , it worked fine , i have successfully regenerated the failed ZIMs and verified the download links works fine
I tried to explain the issue well , please review it , maybe I found the causes of the issue , but actually I'm not sure if this is the correct way to solve it
fixes #1036