Commit 9b72161
committed
refactor: replace _previous_leased with derived LeaseState
Introduce LeaseState enum and _lease_state property derived from
_lease_context, eliminating a class of state-synchronization bugs
where _previous_leased could drift from _lease_context.
Key changes:
- Wrap handle_lease body in try/finally so early returns (stale lease,
session setup race) always clean up _lease_context and log context
- Reject overlapping leases in _apply_status instead of silently
replacing _lease_context, preventing concurrent handle_lease tasks
- Move before-lease hook spawn into _on_lease_acquired for cleaner
ownership of lease startup
- Remove stale _previous_leased from test fixtures
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Assited-by: claude-opus-4.61 parent 702a9d2 commit 9b72161
2 files changed
Lines changed: 402 additions & 150 deletions
0 commit comments