fix: use spawner.orm_spawner.last_activity (Server object has no last_activity)

This commit is contained in:
stellarshenson
2026-01-20 10:05:53 +01:00
parent 44f8ce0318
commit d2ff63b2e1
2 changed files with 6 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ PROJECT_NAME="stellars-jupyterhub-ds"
PROJECT_DESCRIPTION="Multi-user JupyterHub 4 deployment platform with data science stack, GPU auto-detection, NativeAuthenticator, and isolated per-user environments spawned via DockerSpawner"
# Version
VERSION="3.6.22_cuda-13.0.2_jh-5.4.2"
VERSION="3.6.23_cuda-13.0.2_jh-5.4.2"
VERSION_COMMENT="Standardize env vars with JUPYTERHUB_ prefix, admin settings page"
RELEASE_TAG="RELEASE_3.2.11"
RELEASE_DATE="2025-11-09"

View File

@@ -624,9 +624,9 @@ class SessionInfoHandler(BaseHandler):
self.log.info(f"[Session Info] {username}: base_timeout={timeout_seconds}s ({timeout_seconds/3600:.1f}h), extensions={extensions_used_hours}h, effective_timeout={effective_timeout}s ({effective_timeout/3600:.1f}h)")
# Get last activity timestamp from SERVER (not user - user.last_activity updates on Hub access)
# The idle culler uses server.last_activity, so we must use the same
last_activity = spawner.server.last_activity if spawner.server else None
# Get last activity timestamp from SPAWNER (not user - user.last_activity updates on Hub access)
# The idle culler uses spawner.last_activity, so we must use the same
last_activity = spawner.orm_spawner.last_activity if spawner.orm_spawner else None
if last_activity:
from datetime import datetime, timezone
now = datetime.now(timezone.utc)
@@ -753,8 +753,8 @@ class ExtendSessionHandler(BaseHandler):
# Calculate new time remaining: base timeout + ALL extensions - elapsed
extension_seconds = new_total_extensions * 3600
effective_timeout = timeout_seconds + extension_seconds
# Use server.last_activity (not user - matches what idle culler uses)
last_activity = spawner.server.last_activity if spawner.server else None
# Use spawner.last_activity (not user - matches what idle culler uses)
last_activity = spawner.orm_spawner.last_activity if spawner.orm_spawner else None
if last_activity:
now_utc = datetime.now(timezone.utc)
last_activity_utc = last_activity.replace(tzinfo=timezone.utc) if last_activity.tzinfo is None else last_activity