Guard sold reconciliation by scope
This commit is contained in:
@@ -475,6 +475,13 @@ def run_mobilede_sync_search_task(
|
||||
bootstrap_progress: tuple[int, int, int, int, int, int, int] | None = None
|
||||
overflow_segments_added = 0
|
||||
queued_overflow_children = 0
|
||||
early_stopped = bool(result.get("early_stopped"))
|
||||
if refresh_cycle_id and early_stopped:
|
||||
_mobilede_mark_refresh_cycle_reconciliation_unsafe(
|
||||
redis_client,
|
||||
cycle_id=refresh_cycle_id,
|
||||
reason="early_stopped",
|
||||
)
|
||||
segment_max_pages = int((segment or {}).get("max_pages") or max_pages or MOBILEDE_MAX_PAGE_NUMBER)
|
||||
segment_scan_complete = bool(
|
||||
(use_cursor and _mobilede_segment_scan_complete(redis_client, segment))
|
||||
@@ -517,10 +524,16 @@ def run_mobilede_sync_search_task(
|
||||
ex=max(3600, int(MOBILEDE_REFRESH_CYCLE_TTL_SECONDS)),
|
||||
)
|
||||
late_overflow_pending = bool(segment_scan_complete and (overflow_segments_added or queued_overflow_children))
|
||||
if refresh_cycle_id and late_overflow_pending:
|
||||
_mobilede_mark_refresh_cycle_reconciliation_unsafe(
|
||||
redis_client,
|
||||
cycle_id=refresh_cycle_id,
|
||||
reason="plan_changed_or_incomplete",
|
||||
)
|
||||
refresh_done = 0
|
||||
refresh_total = 0
|
||||
should_finalize_refresh = False
|
||||
if refresh_cycle_id and segment_scan_complete:
|
||||
if refresh_cycle_id and segment_scan_complete and not early_stopped:
|
||||
refresh_done, refresh_total, should_finalize_refresh = _mobilede_track_refresh_cycle_segment(
|
||||
redis_client,
|
||||
cycle_id=refresh_cycle_id,
|
||||
@@ -1073,6 +1086,12 @@ def run_mobilede_sync_search_task(
|
||||
status_code = getattr(getattr(exc, "response", None), "status_code", None)
|
||||
is_antibot_block = int(status_code or 0) in {401, 403, 429}
|
||||
is_transient_request_error = _is_mobilede_transient_request_error(exc)
|
||||
if refresh_cycle_id:
|
||||
_mobilede_mark_refresh_cycle_reconciliation_unsafe(
|
||||
redis_client,
|
||||
cycle_id=refresh_cycle_id,
|
||||
reason="http_403" if int(status_code or 0) == 403 else "request_error",
|
||||
)
|
||||
max_retries = int(getattr(self, "max_retries", 0) or 0)
|
||||
current_retries = int(getattr(self.request, "retries", 0) or 0)
|
||||
if is_transient_request_error:
|
||||
|
||||
Reference in New Issue
Block a user