Skip to content

fix: complete cache deletion jobs only after overseer finished creating tasks (MAPCO-11779) - #78

Open
almog8k wants to merge 2 commits into
masterfrom
fix/MAPCO-11779-delete-cache-tasks-creation-flag
Open

almog8k wants to merge 2 commits into
masterfrom
fix/MAPCO-11779-delete-cache-tasks-creation-flag

Conversation

@almog8k

@almog8k almog8k commented Sep 23, 2026

Copy link
Copy Markdown
Contributor
Question Answer
Bug fix ✔
New feature ✖
Breaking change ✖
Deprecations ✖
Documentation ✖
Tests added ✔
Chore ✖

Related issues: MAPCO-11779

Stacked on #77 (MAPCO-11709) — base is feat/MAPCO-11709-support-delete-cache-jobs; retarget to master once #77 is merged.

Further information:

Overseer streams tiles-deletion tasks onto an Update_Delete_Cache job in batches. Workers finish the first batch while later ones are still being enqueued, and DeleteCacheJobHandler.isJobCompleted() returned true on completedTasks === taskCount, so the job was completed early and job-manager rejected the remaining batches with 409 — leaving the Redis cache partially deleted.

  • DeleteCacheJobHandler parses job.parameters with raster-shared's cacheDeletionJobParamsSchema and completes the job only when all tasks are done and tasksCreationCompleted is true. When the flag is false the existing no-next-task path just updates progress.
  • Invalid job parameters are rejected with BadRequestError (400), same pattern as ValidationProceedRule.
  • Bumps @map-colonies/raster-shared to 9.0.0-alpha.2.
  • Tests: delete cache isJobCompleted moved to its own deleteCacheHandler.spec.ts, so baseJobHandler.spec.ts tests only the base behaviour (no job-type filtering). Integration tests cover the flag-false and invalid-parameters paths.

Deployment: requires the matching overseer change (MapColonies/overseer, fix/MAPCO-11779), which sets the flag. Cache deletion jobs created by an older overseer have no flag and will get a 400 here — deploy overseer first/together and let in-flight cache deletion jobs drain.

Known, accepted gap: if every task completes before overseer writes the flag (flag update slow/retried, or overseer crashing in between), the job stays In Progress at 100%. Very unlikely under normal load (workers poll every 3s); overseer intentionally doesn't complete jobs itself.

Base automatically changed from feat/MAPCO-11709-support-delete-cache-jobs to master October 4, 2026 11:35

@CL-SHLOMIKONCHA CL-SHLOMIKONCHA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but conflict should be resolve in order to re-view it

…ng tasks (MAPCO-11779)

Overseer streams tiles-deletion tasks onto the cache deletion job in batches,
so workers finish the first batch while later ones are still being enqueued.
The job was completed as soon as completedTasks === taskCount, and job-manager
then rejected the remaining batches with 409.

- parse job parameters with raster-shared's cacheDeletionJobParamsSchema and
  complete the job only when tasksCreationCompleted is true; otherwise only
  update progress
- reject invalid job parameters with BadRequestError
- bump @map-colonies/raster-shared to 9.0.0-alpha.2
- move delete cache isJobCompleted tests to their own handler spec so the
  base handler spec tests only the base behaviour
@almog8k
almog8k force-pushed the fix/MAPCO-11779-delete-cache-tasks-creation-flag branch from 50e581e to 3cd8e6e Compare October 4, 2026 11:59
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