From b84e3f77f3766a0367d84bdf958988dc5c4b7fa2 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Sun, 18 May 2025 18:56:30 -0500 Subject: [PATCH] Fixed custom props not being loaded. --- apps/epg/tasks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/epg/tasks.py b/apps/epg/tasks.py index c66fdff7..17b9faf8 100644 --- a/apps/epg/tasks.py +++ b/apps/epg/tasks.py @@ -975,6 +975,7 @@ def parse_programs_for_tvg_id(epg_id): # Extract custom properties custom_props = extract_custom_properties(elem) + custom_properties_json = None if custom_props: logger.trace(f"Number of custom properties: {len(custom_props)}") @@ -1022,6 +1023,19 @@ def parse_programs_for_tvg_id(epg_id): except Exception as e: logger.error(f"Error processing program for {epg.tvg_id}: {e}", exc_info=True) + else: + # Immediately clean up non-matching elements to reduce memory pressure + elem.clear() + parent = elem.getparent() + if parent is not None: + while elem.getprevious() is not None: + del parent[0] + try: + parent.remove(elem) + except (ValueError, KeyError, TypeError): + pass + del elem + continue # Important: Clear the element to avoid memory leaks using a more robust approach try: