add vps check
This commit is contained in:
@@ -578,9 +578,14 @@ def _should_restart_for_db_idle(progress: dict, db_idle_restart_seconds: int) ->
|
||||
stage = str(progress.get("stage") or "")
|
||||
if stage in TERMINAL_PROGRESS_STAGES:
|
||||
return False
|
||||
# Listing/segment progress means the task is alive even if it writes no new
|
||||
# cars. This is normal for hourly only_new runs when all vehicles are already
|
||||
# present in DB. Do not kill healthy scans just because DB progress is idle.
|
||||
progress_ts = _safe_int(progress.get("ts")) or 0
|
||||
if progress_ts > 0 and int(time.time()) - progress_ts < int(db_idle_restart_seconds):
|
||||
return False
|
||||
if stage in STALL_WATCHDOG_LONG_RUNNING_STAGES:
|
||||
timeout = _stall_timeout_for_progress(stage, db_idle_restart_seconds)
|
||||
progress_ts = _safe_int(progress.get("ts")) or 0
|
||||
return progress_ts > 0 and int(time.time()) - progress_ts >= timeout
|
||||
|
||||
segments_total = _safe_int(progress.get("segments_total"))
|
||||
@@ -591,7 +596,6 @@ def _should_restart_for_db_idle(progress: dict, db_idle_restart_seconds: int) ->
|
||||
return False
|
||||
|
||||
now_ts = int(time.time())
|
||||
progress_ts = _safe_int(progress.get("ts")) or 0
|
||||
if progress_ts <= 0:
|
||||
return False
|
||||
|
||||
@@ -1051,10 +1055,17 @@ def _build_listing_segments(settings: Settings) -> list[dict[str, str | int | No
|
||||
|
||||
runtime_config = RuntimeConfig.from_file(settings.runtime_config_file)
|
||||
brands = runtime_config.filters.include.brands
|
||||
if settings.scraping_profile.http_first and settings.listing.fast_segment_year_splits:
|
||||
|
||||
# Fast HTTP-first режим не использует UI year-фильтры IAAI.
|
||||
# Значит runtime-сегменты должны быть "один бренд = один сегмент"
|
||||
# без доп. year split, иначе получаем много лишних долгих сегментов,
|
||||
# которые fast-профиль всё равно игнорирует.
|
||||
if settings.scraping_profile.http_first:
|
||||
segments = build_fast_listing_segments_for_makes(list(brands))
|
||||
else:
|
||||
elif settings.listing.fast_segment_year_splits:
|
||||
segments = build_listing_segments_for_makes(list(brands))
|
||||
else:
|
||||
segments = build_fast_listing_segments_for_makes(list(brands))
|
||||
if not segments:
|
||||
logger.warning(
|
||||
"IAAI_LISTING_SEGMENTS=runtime, but runtime_config filters.brands is empty; segmented listing disabled"
|
||||
|
||||
Reference in New Issue
Block a user