fix(remote): measure the idle time of a remote session on a monotonic clock

This commit is contained in:
imSp4rky
2026-11-30 17:06:15 -07:00
parent 34a3820eb8
commit e813737506
6 changed files with 59 additions and 31 deletions
+3 -2
View File
@@ -624,7 +624,7 @@ Source: `unshackle/core/api/session_store.py`. A singleton you get from
- **Expiry.** `get()` and `cleanup_expired()` use one rule. A remote session that no request holds
expires when it is idle for longer than `ttl`. While its login runs (`AUTHENTICATING`), the limit is
the larger of `ttl` and `AUTH_INPUT_TIMEOUT`.
- **`get()`** refreshes `last_accessed` through `touch()`. It returns `None` and
- **`get()`** refreshes `last_accessed` and `idle_since` through `touch()`. It returns `None` and
deletes the entry when the remote session has expired.
- **`cleanup_expired()`** runs every 60s and removes each expired remote session.
- **Removal.** Eviction, expiry and `delete()` end the remote session the same way: they cancel its
@@ -649,7 +649,8 @@ Source: `unshackle/core/api/session_store.py`. A singleton you get from
| `cache_tag` | Per-session cache directory tag |
| `input_bridge` | `InputBridge` for interactive auth, if any |
| `auth_status` / `auth_error` | Current `AuthStatus`, read from `input_bridge` (`AUTHENTICATED` without one), and last error message |
| `created_at` / `last_accessed` | Timestamps; `last_accessed` drives TTL and LRU eviction |
| `created_at` / `last_accessed` | Timestamps; `last_accessed` drives LRU eviction |
| `idle_since` | Monotonic time of the last access; it drives the TTL, so a step of the system clock expires no remote session |
### Per-session cache namespacing