Hotfix: cleanup legacy v2 containers + auto-expire ringing calls (v2.2.44)
This commit is contained in:
parent
803b45fab4
commit
701cc63375
17
RELEASE_NOTES_v2.2.44.md
Normal file
17
RELEASE_NOTES_v2.2.44.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Release Notes v2.2.44
|
||||||
|
|
||||||
|
Dato: 4. marts 2026
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
- `updateto.sh` rydder nu automatisk legacy containere (`bmc-hub-api-v2`, `bmc-hub-postgres-v2`) før deploy.
|
||||||
|
- Forebygger port-lock konflikter på især Postgres host-port (`5433`) under compose opstart.
|
||||||
|
- Mission Control: automatisk timeout på hængende `ringing` opkald, så de ikke bliver stående i Incoming Calls.
|
||||||
|
|
||||||
|
## Ændrede filer
|
||||||
|
- `updateto.sh`
|
||||||
|
- `app/dashboard/backend/mission_service.py`
|
||||||
|
- `VERSION`
|
||||||
|
|
||||||
|
## Drift
|
||||||
|
- Deploy: `./updateto.sh v2.2.44`
|
||||||
|
- Verificér: `curl http://localhost:8001/health`
|
||||||
@ -5,6 +5,30 @@ from app.core.database import execute_query, execute_query_single
|
|||||||
|
|
||||||
|
|
||||||
class MissionService:
|
class MissionService:
|
||||||
|
@staticmethod
|
||||||
|
def get_ring_timeout_seconds() -> int:
|
||||||
|
raw = MissionService.get_setting_value("mission_call_ring_timeout_seconds", "180") or "180"
|
||||||
|
try:
|
||||||
|
value = int(raw)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
value = 180
|
||||||
|
return max(30, min(value, 3600))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def expire_stale_ringing_calls() -> None:
|
||||||
|
timeout_seconds = MissionService.get_ring_timeout_seconds()
|
||||||
|
execute_query(
|
||||||
|
"""
|
||||||
|
UPDATE mission_call_state
|
||||||
|
SET state = 'hangup',
|
||||||
|
ended_at = COALESCE(ended_at, NOW()),
|
||||||
|
updated_at = NOW()
|
||||||
|
WHERE state = 'ringing'
|
||||||
|
AND started_at < (NOW() - make_interval(secs => %s))
|
||||||
|
""",
|
||||||
|
(timeout_seconds,),
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_setting_value(key: str, default: Optional[str] = None) -> Optional[str]:
|
def get_setting_value(key: str, default: Optional[str] = None) -> Optional[str]:
|
||||||
row = execute_query_single("SELECT value FROM settings WHERE key = %s", (key,))
|
row = execute_query_single("SELECT value FROM settings WHERE key = %s", (key,))
|
||||||
@ -144,6 +168,7 @@ class MissionService:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_active_calls() -> list[Dict[str, Any]]:
|
def get_active_calls() -> list[Dict[str, Any]]:
|
||||||
|
MissionService.expire_stale_ringing_calls()
|
||||||
rows = execute_query(
|
rows = execute_query(
|
||||||
"""
|
"""
|
||||||
SELECT call_id, queue_name, caller_number, contact_name, company_name, customer_tag, state, started_at, answered_at, ended_at, updated_at
|
SELECT call_id, queue_name, caller_number, contact_name, company_name, customer_tag, state, started_at, answered_at, ended_at, updated_at
|
||||||
|
|||||||
@ -74,6 +74,13 @@ fi
|
|||||||
|
|
||||||
echo "✅ .env opdateret"
|
echo "✅ .env opdateret"
|
||||||
|
|
||||||
|
# Cleanup legacy container names from older compose variants (can lock host ports)
|
||||||
|
echo ""
|
||||||
|
echo "🧹 Rydder legacy containere (v2-navne)..."
|
||||||
|
podman update --restart=no bmc-hub-api-v2 bmc-hub-postgres-v2 >/dev/null 2>&1 || true
|
||||||
|
podman stop bmc-hub-api-v2 bmc-hub-postgres-v2 >/dev/null 2>&1 || true
|
||||||
|
podman rm -f bmc-hub-api-v2 bmc-hub-postgres-v2 >/dev/null 2>&1 || true
|
||||||
|
|
||||||
# Guard against host port conflicts before attempting startup
|
# Guard against host port conflicts before attempting startup
|
||||||
POSTGRES_BIND_ADDR="${POSTGRES_BIND_ADDR:-127.0.0.1}"
|
POSTGRES_BIND_ADDR="${POSTGRES_BIND_ADDR:-127.0.0.1}"
|
||||||
POSTGRES_PORT="${POSTGRES_PORT:-5432}"
|
POSTGRES_PORT="${POSTGRES_PORT:-5432}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user