mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-23 08:55:44 +08:00
fix(monitoring): restore Cloud in-flight snapshots and collapsed dock
This commit is contained in:
@@ -1691,9 +1691,14 @@ class MonitoringService(ExecutionDetailsMixin):
|
||||
|
||||
workspace = require_workspace_uuid(context)
|
||||
active = await self.get_executions(context, statuses=['running', 'queued'], limit=100, include_summary=False)
|
||||
# Execution timestamps are stored as UTC without a timezone. asyncpg
|
||||
# rejects aware datetimes for these columns, even though SQLite accepts them.
|
||||
recent_start = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) - datetime.timedelta(
|
||||
seconds=30
|
||||
)
|
||||
recent = await self.get_executions(
|
||||
context,
|
||||
start_time=datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(seconds=30),
|
||||
start_time=recent_start,
|
||||
limit=100,
|
||||
include_summary=False,
|
||||
)
|
||||
|
||||
@@ -7,9 +7,13 @@ No payloads or subscriptions survive the final viewer disconnecting.
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import logging
|
||||
import time
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InflightHub:
|
||||
def __init__(self):
|
||||
self.channels = {}
|
||||
@@ -75,6 +79,8 @@ class InflightHub:
|
||||
snapshot = await loader()
|
||||
frame = {'kind': 'snapshot', 'data': snapshot}
|
||||
except Exception:
|
||||
if previous is None or previous['kind'] != 'unavailable':
|
||||
logger.exception('Failed to load in-flight monitoring snapshot')
|
||||
frame = {'kind': 'unavailable'}
|
||||
# Heartbeats are sent separately; unchanged snapshots generate no traffic.
|
||||
if frame != previous:
|
||||
|
||||
Reference in New Issue
Block a user