fix(sync): a failed feed-fallback read waits its window out, and spent quota ends the round
A channel whose uploads playlist also failed was never stamped, so a terminated channel was charged again on every 20-minute poll instead of once per rss_fallback_hours. An upstream quotaExceeded now stops the round instead of charging every remaining channel the same refusal.
This commit is contained in:
@@ -93,6 +93,14 @@ def _upstream_failure(
|
||||
# The `mine` reads' answer for a Google account that has no YouTube channel.
|
||||
_NO_CHANNEL = frozenset({"channelNotFound"})
|
||||
|
||||
# The reasons that mean the project's quota is spent: every further call today gets the same answer.
|
||||
_QUOTA_REASONS = frozenset({"quotaExceeded", "dailyLimitExceeded"})
|
||||
|
||||
|
||||
def is_quota_refusal(exc: YouTubeError) -> bool:
|
||||
"""Whether the API refused for want of quota. `reason` can list several codes, comma-joined."""
|
||||
return any(r in _QUOTA_REASONS for r in exc.reason.split(","))
|
||||
|
||||
|
||||
def _chunks(items: list, size: int) -> Iterator[list]:
|
||||
for i in range(0, len(items), size):
|
||||
|
||||
Reference in New Issue
Block a user