8000 fix: re-queue COMPLETED cache jobs on cache miss by tamzrod · Pull Request #112 · tamzrod/Librarian · GitHub
[go: up one dir, main page]

Skip to content

fix: re-queue COMPLETED cache jobs on cache miss - #112

Merged
tamzrod merged 1 commit into
mainfrom
fix/cache-regeneration-on-completed-jobs
Jul 6, 2026
Merged

tamzrod merged 1 commit into
mainfrom
fix/cache-regeneration-on-completed-jobs

Conversation

@tamzrod
@tamzrod tamzrod commented Jul 6, 2026
Copy link
Copy Markdown
Owner

Summary

Filesystem existence is now authoritative for cache artifacts, not job history.

When a cache artifact is missing:

  1. Check if a job is IN_PROGRESS - if so, do not interfere
  2. If not IN_PROGRESS, re-queue COMPLETED cache jobs for regeneration
  3. COMPLETED represents historical execution only, never blocks regeneration

Changes

  • storage/postgres_backend.py: Added CACHE_JOB_TYPES constant for cache-producing job types
  • storage/postgres_backend.py: Modified create_job() to re-queue COMPLETED cache jobs
  • storage/postgres_backend.py: Modified create_or_update_thumbnail_job() to re-queue COMPLETED jobs

Affected Cache-Producing Plugins

  • generate_thumbnail
  • object_detection
  • transcription

API Contract

Thumbnail endpoint now correctly:

  1. ✅ Queues regeneration (if enabled)
  2. ✅ Returns HTTP 200
  3. ✅ Returns a valid placeholder JPEG
  4. ✅ Never returns HTTP 500
  5. ✅ Re-queues COMPLETED jobs for cache regeneration

@tamzrod can click here to continue refining the PR

Filesystem existence is authoritative for cache artifacts, not job
history. When a cache artifact is missing:

1. Check if a job is IN_PROGRESS - if so, don't interfere
2. If not IN_PROGRESS, re-queue COMPLETED cache jobs for regeneration
3. COMPLETED represents historical execution only, never blocks regeneration

This applies to all cache-producing plugins:
- generate_thumbnail
- object_detection
- transcription

Changes:
- Added CACHE_JOB_TYPES constant for cache-producing job types
- Modified create_job() to re-queue COMPLETED cache jobs
- Modified create_or_update_thumbnail_job() to re-queue COMPLETED jobs
@tamzrod
tamzrod marked this pull request as ready for review July 6, 2026 23:35
@tamzrod
tamzrod merged commit 6d80a9e into main Jul 6, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0