Skip to content

Release File Search leases on shutdown after at most 20 s (#1383) - #1397

Merged
helpcodeai merged 1 commit into
mainfrom
fix/file-search-worker-stop
Nov 1, 2026
Merged

helpcodeai merged 1 commit into
mainfrom
fix/file-search-worker-stop

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Found while monitoring File Search on the Cloud with a real FTPS archive (4,168 PDFs behind a slow upload line). On a deploy, files-worker waited for its running slice before releasing the source lease. The slice took longer than Docker's 10 s stop timeout, the container was killed, and the sync sat idle until the 10-minute lease expired.

Changes

  • SyncScheduler.stop() waits at most 20 s for running slices, then releases its leases anyway. Progress is stored per file, so the next worker continues where the slice stopped.
  • files-worker gets stop_grace_period: 30s in docker-compose.yml and docker-compose.cloud.yml.

Cloud and self-hosted behave the same way.

Type

  • Bug fix

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
Directory Command Result
packages/backend npx tsc --noEmit -p tsconfig.json clean
packages/backend npx jest src/ee/file-search --maxWorkers=2 17 passed, 5 skipped (gated integration)
root docker compose -f docker-compose.cloud.yml config -q valid

Observed on the Cloud on 2026-11-01: after the deploy at 14:51 UTC the old worker's lease stayed until 15:00 UTC.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • This PR has a descriptive title

Related Issues

Relates to #1383, #1379.

A slice on a slow server outlasted Docker's stop timeout, so the worker
was killed before it released its lease and the sync waited ten minutes
after every deploy. Give files-worker a 30 s stop grace period.
@helpcodeai
helpcodeai enabled auto-merge (squash) November 1, 2026 14:55
@helpcodeai
helpcodeai merged commit 5e81367 into main Nov 1, 2026
15 checks passed
@helpcodeai
helpcodeai deleted the fix/file-search-worker-stop branch November 1, 2026 15:09
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant