lablink_allocator_service.admin_session_expiry¶
lablink_allocator_service.admin_session_expiry
¶
Admin-session expiry sweep.
Periodically releases VMs an admin reserved for troubleshooting (admin_reserve_vm) but never explicitly released, so an admin closing the /desktop tab without clicking "Release" doesn't leave the VM stuck out of the assignable pool forever. This is a fixed-duration safety net, not activity-based idle detection — the allocator has no visibility into whether the admin's VNC WebSocket is still open once nginx's auth_request handshake has succeeded once.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
AdminSessionExpiryService(database, timeout_minutes=30, check_interval_seconds=300)
¶
Background service that releases expired admin VM reservations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database
|
VmDatabase
|
VmDatabase instance for querying/updating VM state. |
required |
timeout_minutes
|
int
|
Age, in minutes, past which a reservation is considered expired and force-released. |
30
|
check_interval_seconds
|
int
|
How often to sweep for expired reservations. |
300
|
Source code in packages/allocator/src/lablink_allocator_service/admin_session_expiry.py
Attributes¶
check_interval_seconds = check_interval_seconds
instance-attribute
¶
database = database
instance-attribute
¶
timeout_minutes = timeout_minutes
instance-attribute
¶
Methods:¶
start()
¶
Start the sweep thread.