Schedule stale gallery enrichment

This commit is contained in:
qananasikq
2026-08-18 10:40:26 +03:00
parent 19007dafc8
commit ca1fab1034
15 changed files with 460 additions and 82 deletions
+15 -3
View File
@@ -5,7 +5,7 @@ from types import SimpleNamespace
import unittest
from unittest.mock import MagicMock, patch
from mobilede_scraper.worker import tasks
from mobilede_scraper.worker import planner, tasks
class TestWorkerRuntimeTaskHelpers(unittest.TestCase):
@@ -553,7 +553,13 @@ class TestWorkerRuntimeTaskHelpers(unittest.TestCase):
previous = os.environ.get("MOBILEDE_FILTERED_URL_FAST_START")
try:
os.environ["MOBILEDE_FILTERED_URL_FAST_START"] = "false"
segments = tasks._build_mobilede_runtime_segments(settings)
with (
patch.object(planner, "_mobilede_try_keep_root_segment_unsplit", return_value=None),
patch.object(planner, "_expand_mobilede_search_url_segment_by_probe", return_value=None),
patch.object(planner, "_mobilede_probe_total", return_value=None),
patch.object(planner, "_mobilede_preplan_runtime_segments", side_effect=lambda items: items),
):
segments = tasks._build_mobilede_runtime_segments(settings)
finally:
if previous is None:
os.environ.pop("MOBILEDE_FILTERED_URL_FAST_START", None)
@@ -578,7 +584,13 @@ class TestWorkerRuntimeTaskHelpers(unittest.TestCase):
try:
tasks.MOBILEDE_SPLIT_SEGMENTS_BY_MILEAGE = True
os.environ["MOBILEDE_FILTERED_URL_FAST_START"] = "false"
segments = tasks._build_mobilede_runtime_segments(settings)
with (
patch.object(planner, "_mobilede_try_keep_root_segment_unsplit", return_value=None),
patch.object(planner, "_expand_mobilede_search_url_segment_by_probe", return_value=None),
patch.object(planner, "_mobilede_probe_total", return_value=None),
patch.object(planner, "_mobilede_preplan_runtime_segments", side_effect=lambda items: items),
):
segments = tasks._build_mobilede_runtime_segments(settings)
finally:
tasks.MOBILEDE_SPLIT_SEGMENTS_BY_MILEAGE = original_split
if previous_fast_start is None: