Module uploads

Module uploads 

Source
Expand description

Query functions for the stream upload queue.

The upload queue is not a separate table; it operates on the streams table using the upload_status, upload_attempts, and last_upload_error columns to track the lifecycle of each stream’s upload to the Rdio API.

§Upload Lifecycle

pending ──► uploaded    (success: mark_uploaded)
   │
   ├──► pending         (transient failure: increment_attempts)
   │
   └──► failed          (permanent failure or max retries: mark_failed)

The upload processor polls get_pending on a timer, attempts each upload, and calls the appropriate status-transition function based on the result. Only streams with non-null audio_mp3 are returned by get_pending, ensuring that in-progress streams (still recording) are not prematurely queued.

Functions§

get_pending 🔒
Returns streams awaiting upload, ordered by creation time.
increment_attempts 🔒
Increments the attempt counter and records the error for a retryable failure.
mark_failed 🔒
Marks a stream as permanently failed.
mark_uploaded 🔒
Marks a stream as successfully uploaded.