Guard sold reconciliation by scope
This commit is contained in:
@@ -39,6 +39,7 @@ from .refresh_cycle import (
|
||||
_mobilede_clear_refresh_cycle as _refresh_cycle_clear_state,
|
||||
_mobilede_finalize_refresh_cycle_sold_marking as _refresh_cycle_finalize_sold_marking,
|
||||
_mobilede_get_or_start_refresh_cycle as _refresh_cycle_get_or_start,
|
||||
_mobilede_mark_refresh_cycle_reconciliation_unsafe as _refresh_cycle_mark_unsafe,
|
||||
_mobilede_redis_text as _refresh_cycle_redis_text,
|
||||
_mobilede_refresh_cycle_done_set_key as _refresh_cycle_done_set_key_impl,
|
||||
_mobilede_refresh_cycle_finalized_key as _refresh_cycle_finalized_key_impl,
|
||||
@@ -1435,6 +1436,20 @@ def _mobilede_get_or_start_refresh_cycle(redis_client: Redis, *, total_segments:
|
||||
return _refresh_cycle_get_or_start(redis_client, total_segments=total_segments, logger=logger)
|
||||
|
||||
|
||||
def _mobilede_mark_refresh_cycle_reconciliation_unsafe(
|
||||
redis_client: Redis,
|
||||
*,
|
||||
cycle_id: str | None,
|
||||
reason: str,
|
||||
) -> None:
|
||||
_refresh_cycle_mark_unsafe(
|
||||
redis_client,
|
||||
cycle_id=cycle_id,
|
||||
reason=reason,
|
||||
logger=logger,
|
||||
)
|
||||
|
||||
|
||||
def _mobilede_refresh_cycle_seen_at(redis_client: Redis, *, cycle_id: str | None) -> datetime | None:
|
||||
return _refresh_cycle_seen_at_impl(redis_client, cycle_id=cycle_id, logger=logger)
|
||||
|
||||
@@ -2364,6 +2379,25 @@ def mobilede_sync_runtime_segments_task(
|
||||
redis_client,
|
||||
total_segments=len(cached_segments or []),
|
||||
)
|
||||
partial_scope_reasons: list[str] = []
|
||||
if runtime_config.sync.only_new is True:
|
||||
partial_scope_reasons.append("only_new")
|
||||
if runtime_config.sync.limit is not None:
|
||||
partial_scope_reasons.append("sync_limit")
|
||||
runtime_filters = getattr(runtime_config, "filters", None)
|
||||
if runtime_filters is not None and not runtime_filters.is_empty():
|
||||
partial_scope_reasons.append("runtime_filters")
|
||||
if getattr(settings.listing, "filtered_search_urls", None):
|
||||
partial_scope_reasons.append("filtered_search_urls")
|
||||
mobilede_config = getattr(runtime_config, "mobilede", None)
|
||||
if mobilede_config is not None and getattr(mobilede_config, "segments", ()):
|
||||
partial_scope_reasons.append("runtime_segments")
|
||||
for reason in partial_scope_reasons:
|
||||
_mobilede_mark_refresh_cycle_reconciliation_unsafe(
|
||||
redis_client,
|
||||
cycle_id=refresh_cycle_id,
|
||||
reason=reason,
|
||||
)
|
||||
if bootstrap_recovery_pending:
|
||||
redis_client.delete(MOBILEDE_BOOTSTRAP_RECOVERY_PENDING_KEY)
|
||||
segments = _enqueue_mobilede_runtime_segments(
|
||||
|
||||
Reference in New Issue
Block a user