Repository navigation
feat(locks): add renewal worker - #82
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cc8f44296
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def _run(self) -> None: | ||
| while not self._guard.lost: | ||
| if self._stop.wait(self._guard.renewal_delay()): |
There was a problem hiding this comment.
Stop renewing once the absolute deadline cannot advance
When a guard enters the final two seconds of its 90-day absolute lifetime, renewal_delay() returns zero, but a successful renewal is still accepted with its deadline capped at the unchanged absolute deadline. This loop therefore immediately issues another renewal and can hammer the API continuously until the deadline expires; treat a renewal that cannot extend the capped deadline as terminal or otherwise avoid rescheduling it with zero delay.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the current head. A replacement lease is now rejected when the absolute lifetime leaves no safe renewal window, so the worker terminates instead of entering a zero-delay loop.
|
|
||
| def _run(self) -> None: | ||
| while not self._guard.lost: | ||
| if self._stop.wait(self._guard.renewal_delay()): |
There was a problem hiding this comment.
Recompute the renewal deadline after system suspend
On Linux, Event.wait() uses a monotonic timeout that does not advance during system suspend, while the guard deliberately calculates expiry using suspend-aware CLOCK_BOOTTIME. If the host resumes after the scheduled renewal point but while the lease still has enough time to renew, this wait retains its pre-suspend timeout and can let the lease expire instead of renewing immediately; wait in bounded slices and recompute the suspend-aware delay after each slice.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the current head. Scheduled waits are now capped at one second and compare a fixed renewal target against the suspend-aware lease clock after every slice.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
This slice does not add
with_lock, context-manager cleanup, documentation, or any public facade method.Verification
uv run python scripts/check_openapi.pyuv run ruff check .uv run ruff format --check .uv run mypyuv run pyrightuv run pytest tests/unit -quv run behave features/contract --dry-run --no-snippetsuv run python -m build