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

Function refresh_epg_data

apps/epg/tasks.py:592–621  ·  view source on GitHub ↗
(source_id, force=False)

Source from the content-addressed store, hash-verified

590
591@shared_task(time_limit=14400)
592def refresh_epg_data(source_id, force=False):
593 if not acquire_task_lock('refresh_epg_data', source_id):
594 logger.debug(f"EPG refresh for {source_id} already running")
595 return
596
597 lock_renewer = TaskLockRenewer('refresh_epg_data', source_id)
598 lock_renewer.start()
599
600 _release_task_db_connection()
601
602 try:
603 return _refresh_epg_data_impl(source_id, force=force)
604 except Exception as e:
605 logger.error(
606 f"Error in refresh_epg_data for source {source_id}: {e}",
607 exc_info=True,
608 )
609 _set_epg_source_status(
610 source_id,
611 EPGSource.STATUS_ERROR,
612 f"Error refreshing EPG data: {str(e)[:500]}",
613 notify_error=True,
614 ws_error=str(e)[:500],
615 )
616 finally:
617 _ensure_epg_refresh_terminal_status(source_id)
618 _release_task_db_connection()
619 gc.collect()
620 lock_renewer.stop()
621 release_task_lock('refresh_epg_data', source_id)
622
623
624def _refresh_epg_data_impl(source_id, force=False):

Calls 9

startMethod · 0.95
stopMethod · 0.95
acquire_task_lockFunction · 0.90
TaskLockRenewerClass · 0.90
release_task_lockFunction · 0.90
_refresh_epg_data_implFunction · 0.85
_set_epg_source_statusFunction · 0.85