update sync
This commit is contained in:
@@ -1032,6 +1032,15 @@ def _build_listing_segments(settings: Settings) -> list[dict[str, str | int | No
|
||||
При IAAI_LISTING_SEGMENTS=runtime сегменты строятся из filters.brands / filters.include.brands.
|
||||
Остальные значения IAAI_LISTING_SEGMENTS сохраняют прежнее поведение: auto или JSON.
|
||||
"""
|
||||
filtered_urls = settings.listing.filtered_search_urls
|
||||
if len(filtered_urls) > 1:
|
||||
return [
|
||||
{"make": None, "year_min": None, "year_max": None, "listing_url": url}
|
||||
for url in filtered_urls
|
||||
]
|
||||
if len(filtered_urls) == 1:
|
||||
return []
|
||||
|
||||
raw_segments = settings.listing.listing_segments_json.strip()
|
||||
if raw_segments.casefold() != "runtime":
|
||||
return parse_listing_segments(raw_segments)
|
||||
@@ -1088,7 +1097,10 @@ def sync_segment_task(
|
||||
seg_make = segment.get("make")
|
||||
seg_year_min = segment.get("year_min")
|
||||
seg_year_max = segment.get("year_max")
|
||||
seg_listing_url = segment.get("listing_url")
|
||||
seg_label = f"{seg_make or 'ALL'}"
|
||||
if seg_listing_url:
|
||||
seg_label = "FILTERED_SEARCH"
|
||||
if seg_year_min is not None or seg_year_max is not None:
|
||||
seg_label += f" ({seg_year_min}-{seg_year_max})"
|
||||
|
||||
@@ -1135,6 +1147,7 @@ def sync_segment_task(
|
||||
model=None,
|
||||
lane=lane,
|
||||
only_new=only_new,
|
||||
listing_url=str(seg_listing_url) if seg_listing_url else None,
|
||||
year_min=seg_year_min,
|
||||
year_max=seg_year_max,
|
||||
skip_mark_sold=True,
|
||||
@@ -1422,6 +1435,8 @@ def sync_listing_task(
|
||||
and not always_full_scan
|
||||
)
|
||||
# Определяем сегменты из конфига/env или из runtime_config при IAAI_LISTING_SEGMENTS=runtime.
|
||||
filtered_listing_urls = settings.listing.filtered_search_urls
|
||||
filtered_listing_url = filtered_listing_urls[0] if filtered_listing_urls else None
|
||||
segments = _build_listing_segments(settings)
|
||||
|
||||
watchdog_stop, watchdog_thread = _start_stall_watchdog(
|
||||
@@ -1716,6 +1731,7 @@ def sync_listing_task(
|
||||
lane=lane,
|
||||
limit=effective_limit,
|
||||
only_new=effective_only_new,
|
||||
listing_url=filtered_listing_url,
|
||||
)
|
||||
|
||||
result = _run_browser_job(_job)
|
||||
|
||||
Reference in New Issue
Block a user