Repair Archive download datetimes misread from a SingleFile saved date

Archives parsed before the offset fix keep the shifted download_datetime, because the parser only fills
an empty value.  A one-time background repair (gated by a wrolpi_kv version, after the first refresh)
re-reads each Archive's saved date and corrects a download_datetime that equals the offset-dropped value.
Any other download_datetime is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-23 13:28:46 -06:00
parent 3c07704b9b
commit afd8f157c6
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 126 additions and 11 deletions

14
main.py
View file

@ -423,6 +423,20 @@ async def perpetual_start_video_missing_comments_download():
logger.debug('Waiting for downloads to be enabled before downloading comments...')
@perpetual_signal(sleep=3600)
async def perpetual_repair_archive_saved_dates():
"""Correct Archive download datetimes that were misread from their SingleFile saved date. Runs once."""
async with flags.refresh_complete.wait_for():
# Archives must be in the database.
pass
from modules.archive.lib import repair_singlefile_saved_dates
try:
await asyncio.to_thread(repair_singlefile_saved_dates)
except Exception as e:
logger.error('Failed to repair Archive download datetimes', exc_info=e)
@perpetual_signal(sleep=3600) # Check hourly
async def perpetual_check_for_updates():
"""