MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / _set_epg_source_status

Function _set_epg_source_status

apps/epg/tasks.py:87–114  ·  view source on GitHub ↗

Update source status using a fresh connection (safe after DB failures).

(
    source_id,
    status,
    last_message=None,
    *,
    notify_error=False,
    ws_action="refresh",
    ws_error=None,
)

Source from the content-addressed store, hash-verified

85
86
87def _set_epg_source_status(
88 source_id,
89 status,
90 last_message=None,
91 *,
92 notify_error=False,
93 ws_action="refresh",
94 ws_error=None,
95):
96 """Update source status using a fresh connection (safe after DB failures)."""
97 _release_task_db_connection()
98 update = {"status": status}
99 if last_message is not None:
100 update["last_message"] = last_message
101 try:
102 EPGSource.objects.filter(id=source_id).update(**update)
103 if notify_error:
104 send_epg_update(
105 source_id,
106 ws_action,
107 100,
108 status="error",
109 error=ws_error or last_message,
110 )
111 except Exception as e:
112 logger.error(
113 f"Failed to set EPG source {source_id} status to {status}: {e}"
114 )
115
116
117def _ensure_epg_refresh_terminal_status(source_id):

Callers 1

refresh_epg_dataFunction · 0.85

Calls 4

send_epg_updateFunction · 0.85
updateMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected