Skip to content

Retry YouTube uploads on transient 5xx errors #4

Description

@alimaandev

Problem

shortube/upload.py makes a single attempt to upload. A transient YouTube API 5xx (or rate-limit 429) aborts the whole pipeline with an UploadError even though the upload would succeed a moment later.

Task

Add a bounded retry with exponential backoff around the upload request (e.g. 3 attempts, 2s/4s backoff), only for transient statuses (429, 5xx). Keep permanent errors (403, 401, quota) failing immediately.

Acceptance criteria

  • Unit tests simulate transient-then-success and permanent-failure (mock the youtube.videos().insert() call)
  • Existing tests in tests/test_upload.py still pass
  • Errors are logged per attempt

Files

  • shortube/upload.py
  • tests/test_upload.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions