From 04a55087ddb5854ce911ccd529d1d8eb3919f6c3 Mon Sep 17 00:00:00 2001 From: haunter Date: Mon, 20 Apr 2026 23:59:01 +0300 Subject: [PATCH] fix --- routes/dashboard.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/dashboard.py b/routes/dashboard.py index a504a4d..8f2d433 100644 --- a/routes/dashboard.py +++ b/routes/dashboard.py @@ -70,7 +70,7 @@ def get_towns(): # ------------------------------------------------------------------ # GET /dashboard/client-status # Returns whether the Tampermonkey client is considered online. -# Online = at least one town_state row updated within the last 60 s. +# Online = at least one town_state row updated within the last 150 s. # ------------------------------------------------------------------ @dashboard.route('/dashboard/client-status', methods=['GET']) def client_status(): @@ -85,7 +85,7 @@ def client_status(): try: dt = datetime.fromisoformat(last_seen) age_s = (datetime.utcnow() - dt).total_seconds() - online = age_s <= 60 + online = age_s <= 150 except Exception: online = False else: @@ -132,7 +132,7 @@ def create_command(): if cmd_type not in ('build', 'recruit'): return jsonify({'error': 'type must be build or recruit'}), 400 - # Reject if the Tampermonkey client is offline (no state push in last 60 s) + # Reject if the Tampermonkey client is offline (no state push in last 150 s) conn = get_db() row = conn.execute('SELECT MAX(updated_at) AS last_seen FROM town_state').fetchone() last_seen = row['last_seen'] if row else None @@ -140,7 +140,7 @@ def create_command(): if last_seen: try: dt = datetime.fromisoformat(last_seen) - client_online = (datetime.utcnow() - dt).total_seconds() <= 60 + client_online = (datetime.utcnow() - dt).total_seconds() <= 150 except Exception: pass