fix: prevent stale capacity poisoning and deepen recent-only refill scans
Keep ordinary capacity races from lowering persistent per-account limits. Deepen recent-only discovery within the existing age and quality gates. Add offline regressions for recovery and reserved-slot refill.
This commit is contained in:
@@ -822,6 +822,17 @@ def build_adaptive_scan_stages(
|
||||
"limit": max_models,
|
||||
}
|
||||
)
|
||||
if not allow_older_than_recent_window:
|
||||
# Reserved positions still need a deep search of eligible recent
|
||||
# models. Widening the date window alone repeatedly scans the same
|
||||
# short prefix (often already processed) on every poll cycle.
|
||||
stages.append(
|
||||
{
|
||||
"name": "recent_window_full",
|
||||
"updatedAfter": recent_cutoff,
|
||||
"limit": max_models,
|
||||
}
|
||||
)
|
||||
deduped: list[dict[str, Any]] = []
|
||||
seen: set[tuple[str | None, int, str]] = set()
|
||||
for stage in stages:
|
||||
|
||||
@@ -1029,7 +1029,12 @@ class ModelHubClientPool:
|
||||
self._capacity_probe_cooldown_until[index] = (
|
||||
self._capacity_probe_cycle + self._capacity_probe_cooldown_cycles
|
||||
)
|
||||
else:
|
||||
elif self._weekly_target_locked() == index:
|
||||
# Only the scheduled calibration may lower a learned cap.
|
||||
# Ordinary rejection can race with another agent filling this
|
||||
# account; our cached count is not evidence of its capacity.
|
||||
# Persisting it (even zero -> one) strands otherwise usable
|
||||
# positions until the next calibration.
|
||||
observed_capacity = max(1, self._effective_count_locked(index))
|
||||
if observed_capacity < self._account_caps[index]:
|
||||
self._account_caps[index] = observed_capacity
|
||||
|
||||
Reference in New Issue
Block a user