[codex] fix(worker): cache missing schemas_with_pending_work helper#1212
Draft
JulienJBO wants to merge 1 commit intovectorize-io:mainfrom
Draft
[codex] fix(worker): cache missing schemas_with_pending_work helper#1212JulienJBO wants to merge 1 commit intovectorize-io:mainfrom
JulienJBO wants to merge 1 commit intovectorize-io:mainfrom
Conversation
Author
|
Closing this draft while local validation is still in progress. I will reopen or submit a fresh PR once tests and Sonar checks are complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
schemas_with_pending_work()helper after the firstUndefinedFunctionErrorRoot Cause
WorkerPoller._scan_active_schemas()triedSELECT * FROM schemas_with_pending_work()on every poll tick until success. In local and self-hosted deployments where that optional helper function is not installed, the worker correctly fell back to per-schemaEXISTSchecks, but PostgreSQL still logged anUndefinedFunctionerror every 500ms.That made the fallback effectively noisy forever even though the absence of the helper is a stable condition for the lifetime of the process.
Fix
When the fast-path query fails specifically with
asyncpg.exceptions.UndefinedFunctionError, mark the helper as unavailable for the current worker process and skip future probes. Other exception types still fall back without disabling future attempts, preserving the existing behavior for transient failures.Testing
uv run pytest tests/test_worker.py::TestClaimBatchRotation::test_scan_caches_missing_server_side_pending_work_function -vuv run ruff check hindsight_api/worker/poller.py tests/test_worker.py./scripts/hooks/lint.shImpact
This removes persistent PostgreSQL log spam in deployments that do not install the optional helper function, without changing task claiming semantics.