fix(poller): use sleep_coalesce for housekeeping loops#69
Closed
HonestMajority wants to merge 4 commits intomainfrom
Closed
fix(poller): use sleep_coalesce for housekeeping loops#69HonestMajority wants to merge 4 commits intomainfrom
HonestMajority wants to merge 4 commits intomainfrom
Conversation
…ual clock
When lana-bank runs with time.mode=manual, the global es-entity Clock
never advances autonomously. The keep-alive heartbeat and lost-job
detector loops used regular sleep(), which registers a wake that fires
at each intermediate boundary — but with a manual clock those
boundaries never arrive, so both loops freeze indefinitely.
Switch the two housekeeping sleeps in start_keep_alive_handler() and
start_lost_handler() to sleep_coalesce(). Coalesceable sleeps fire
once at the end of Clock::advance() instead of at every intermediate
tick, which means:
1. The loops actually wake up when advance() is called.
2. Large time jumps don't cause O(advance / interval) spurious
wake-ups — only one wake per advance().
Also bumps es-entity from 0.10 to 0.10.31 and adapts to its breaking
API changes (per-operation error types, maybe_now(), EntityHydrationError,
DbOp-based transaction handling).
Closes GaloyMoney/volcano-wip#730
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Closing as superseded by #68, which was already merged and addresses the same issue (sleep_coalesce in housekeeping loops + es-entity 0.10.31 bump). |
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
sleep()tosleep_coalesce()so they actually wake when the global manual clock is advancedes-entityfrom0.10to0.10.31and adapt to its breaking API changes (per-operation error types,maybe_now(),EntityHydrationError,DbOp-based transaction handling)es-entity/sim-timefeature flag from thesim-timefeatureCloses GaloyMoney/volcano-wip#730
Detail
When lana-bank runs with
time.mode=manual, the global es-entityClocknever advances autonomously. The keep-alive and lost-job loops used regularsleep(), which registers wakes at intermediate boundaries — boundaries that never arrive with a manual clock, causing both loops to freeze indefinitely.sleep_coalesce()fires once at the end ofClock::advance()instead of at every intermediate tick, so:advance()is called.es-entity 0.10.31 migration
The bump required adapting to several breaking changes:
EsEntityError→EntityHydrationErrorfrom_es_entity_error!macro removed → manualFromimpls for generated per-operation error types (JobCreateError,JobFindError,JobModifyError,JobQueryError)AtomicOperation::now()→maybe_now()EntityEvents::load_first()now returnsOption<T>DbOpno longer implementsInto<Transaction>→ splitcomplete_job/reschedule_jobintoDbOpandTransactionvariantserr = "..."attribute removed from#[es_repo]constraint = "idx_unique_job_type"for custom index name matchingTest plan
cargo nextest run)--features sim-timecargo fmtcleanClock::install_manual(), blocking job runners, DB polling assertions)🤖 Generated with Claude Code