Resolved

Python asyncio priority queue blocks unrelated platform uploads

Python
asyncio
Priority Queue
API
YouTube API
Debugging
Backend
Concurrency

YouTube quota backoff incorrectly blocked X platform uploads due to priority queue ordering bug | Asyncio-based video upload system failed to process non-YouTube items during quota limits

X Uploads Blocked by YouTube Quota Backoff

Issue

The video upload system experienced delays and blocking issues when YouTube quota limits were exceeded. During quota backoff periods, X platform uploads (priority 1) were blocked and never processed, even though they should have been handled while YouTube uploads were waiting for the quota reset.

Culprit

The priority queue incorrectly maintained the same priority for YouTube uploads even after they were re-queued due to quota limits. This caused YouTube uploads to continuously re-enter the queue with priority 0, triggering repeated backoff delays that blocked all other uploads, including X platform uploads with priority 1.

Solution

The system was updated to assign a lower priority (998) to YouTube uploads that were re-queued due to quota limits. This ensures that X platform uploads with priority 1 can be processed during the YouTube quota backoff period. The revised priority hierarchy ensures proper queue ordering and prevents unnecessary delays for non-YouTube uploads.