Fix: Komplett auf Europe/Berlin + DB-Migration + Timer-Fix
- ALLE Timestamps einheitlich Europe/Berlin (kein UTC mehr) - DB-Migration: 1704 bestehende Timestamps von UTC nach Berlin konvertiert - Auto-Refresh Timer Fix: ORDER BY id DESC statt completed_at DESC (verhindert falsche Sortierung bei gemischten Timestamp-Formaten) - started_at statt completed_at fuer Timer-Vergleich (konsistenter) - Manuelle Refreshes werden bei Intervall-Pruefung beruecksichtigt - Debug-Logging fuer Auto-Refresh Entscheidungen - astimezone() fuer Timestamps mit Offset-Info Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -3,7 +3,7 @@ import asyncio
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
from config import TIMEZONE
|
||||
from typing import Optional
|
||||
from urllib.parse import urlparse, urlunparse
|
||||
@@ -206,7 +206,7 @@ async def _create_notifications_for_incident(
|
||||
if not notifications:
|
||||
return
|
||||
|
||||
now = datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
|
||||
now = datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
if visibility == "public" and tenant_id:
|
||||
cursor = await db.execute(
|
||||
@@ -465,7 +465,7 @@ class AgentOrchestrator:
|
||||
await db.execute(
|
||||
"""UPDATE refresh_log SET status = 'cancelled', error_message = 'Vom Nutzer abgebrochen',
|
||||
completed_at = ? WHERE incident_id = ? AND status = 'running'""",
|
||||
(datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
(datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
)
|
||||
await db.commit()
|
||||
except Exception as e:
|
||||
@@ -481,7 +481,7 @@ class AgentOrchestrator:
|
||||
await db.execute(
|
||||
"""UPDATE refresh_log SET status = 'error', error_message = ?,
|
||||
completed_at = ? WHERE incident_id = ? AND status = 'running'""",
|
||||
(error[:500], datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
(error[:500], datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
)
|
||||
await db.commit()
|
||||
except Exception as e:
|
||||
@@ -542,12 +542,12 @@ class AgentOrchestrator:
|
||||
await db.execute(
|
||||
"""UPDATE refresh_log SET status = 'error', error_message = 'Retry gestartet',
|
||||
completed_at = ? WHERE incident_id = ? AND status = 'running'""",
|
||||
(datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
(datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S'), incident_id),
|
||||
)
|
||||
await db.commit()
|
||||
|
||||
# Refresh-Log starten
|
||||
now = datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
|
||||
now = datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S')
|
||||
cursor = await db.execute(
|
||||
"INSERT INTO refresh_log (incident_id, started_at, status, trigger_type, retry_count, tenant_id) VALUES (?, ?, 'running', ?, ?, ?)",
|
||||
(incident_id, now, trigger_type, retry_count, tenant_id),
|
||||
@@ -1008,7 +1008,7 @@ class AgentOrchestrator:
|
||||
cache_creation_tokens = ?, cache_read_tokens = ?,
|
||||
total_cost_usd = ?, api_calls = ?
|
||||
WHERE id = ?""",
|
||||
(datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S'), new_count,
|
||||
(datetime.now(TIMEZONE).strftime('%Y-%m-%d %H:%M:%S'), new_count,
|
||||
usage_acc.input_tokens, usage_acc.output_tokens,
|
||||
usage_acc.cache_creation_tokens, usage_acc.cache_read_tokens,
|
||||
round(usage_acc.total_cost_usd, 7), usage_acc.call_count, log_id),
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren