mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 04:20:45 +08:00
Fix more UME split regressions for sync and alarm WSS.
Restore sql_text and alarm-apply imports, slim WSS handshake headers to accessToken only, and treat 404/503 handshakes as lost subscriptions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4054f55988
commit
c91d1571a2
4 changed files with 9 additions and 2 deletions
|
|
@ -29,6 +29,8 @@ from .ume_alarm_ws_subscription import (
|
|||
from .ume_client import UMEClient
|
||||
from .ume_sync_service import (
|
||||
_alarm_key,
|
||||
_utc_now_naive,
|
||||
apply_alarm_to_current,
|
||||
extract_alarm_from_notification,
|
||||
normalize_yang_alarm,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ _SUBSCRIPTION_MISSING_MARKERS: tuple[str, ...] = (
|
|||
"status-code: 404",
|
||||
"status-reason: subscription not found",
|
||||
"non-101 status: 503",
|
||||
"non-101 status: 404",
|
||||
"handshake status 404",
|
||||
"handshake status 503",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -656,10 +656,11 @@ class UMEClient:
|
|||
|
||||
def ws_auth_headers(self) -> dict[str, str]:
|
||||
"""
|
||||
Headers for WSS handshake — same fields as REST (_headers).
|
||||
Headers for WSS handshake — accessToken only (no REST content-type).
|
||||
Does not login/renew; relies on shared token store (token_keepalive / other sync paths).
|
||||
"""
|
||||
self._sync_token_from_store()
|
||||
if not self.has_valid_token():
|
||||
raise RuntimeError("ume_ws_no_valid_token")
|
||||
return self._headers(include_token=True)
|
||||
token = self._token_value.strip()
|
||||
return {self.auth_header: token}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import text as sql_text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from .models import UmeAlarmCurrent, UmeAlarmHistory, UmeInventoryNE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue