fix: set lease_ended on monitor cancellation when end time has passed#599
fix: set lease_ended on monitor cancellation when end time has passed#599raballew wants to merge 2 commits intojumpstarter-dev:mainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| last_known_end_time, | ||
| try: | ||
| while True: | ||
| try: |
There was a problem hiding this comment.
We could consider extractring this block to another private method to improve readability
…jumpstarter-dev#235) When a lease expires during beforeLease hook execution, the lease monitor task gets cancelled before it can detect the expiry and set lease_ended. This causes the client to show "Connection to exporter lost" instead of exiting gracefully. Add a finally block to the _monitor function that checks whether the cached end time has passed when the task is cancelled. If so, it calls _notify_lease_ending to set lease_ended=True, allowing the existing BaseExceptionGroup handler in _shell_with_signal_handling to recognize the lease expiry and exit with code 0. Generated-By: Forge/20260416_202054_681470_f3b15353_i235 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ty type checker cannot narrow pytest.raises(BaseExceptionGroup) value to BaseExceptionGroup, so .exceptions is unresolved. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57132f8 to
9ff38df
Compare
Summary
beforeLeasehook execution, the lease monitor task gets cancelled before detecting the expiry, causing the client to show "Connection to exporter lost" instead of exiting gracefullyfinallyblock to_monitorthat checks whether the cached end time has passed when cancelled, and calls_notify_lease_endingto setlease_ended=TrueCloses #235
Test plan
_monitorsetslease_endedwhen cancelled after end time passesmake pkg-test-jumpstarter🤖 Generated with Claude Code