A retry queue should know why an upload failed and what can change before another attempt. Repeating every error at a fixed short interval wastes battery and cannot repair invalid credentials, missing files, or rejected ownership.
Define the upload lifecycle and the duplicate boundary first. Then choose scheduling that fits the platform and the user's expectations.
Store enough state to recover after restart
Record owner, parent resource, local file reference, logical upload identity, current state, attempt information, and any trusted remote reference. Keep completed, pending, retryable, and review-required outcomes distinct.
Review current platform scheduling support, including Android persistent work where relevant. A Flutter timer alone should not be presented as a guarantee that work survives arbitrary app lifecycle changes.
Retry a fictional report attachment
Suppose a photo upload times out while the device switches networks. A later attempt should resolve whether the original object exists before creating another visible attachment under the chosen protocol.
Test transient network failure, server overload, invalid file, expired credentials, missing local file, deleted parent, and insufficient permission. Assign each a defined action: retry later, renew identity, ask the user, reconcile, or stop with a recoverable explanation.
Add repeated connectivity changes and two workers attempting the same upload. Verify one logical operation retains ownership and that reservations, temporary files, and final record links remain consistent.
Bound attempts and expose useful progress
Use a scheduling policy that avoids hammering a recovering service and respects relevant device conditions. The exact delays and limits should follow the workload and provider contract, not a universal number copied from an example.
Give users a clear pending-work view and a scoped manual retry where safe. A manual action should not bypass duplicate checks or create a new logical upload accidentally. Support needs attempt history and failure categories, with private file contents kept behind controlled access.
The tradeoff is automatic persistence versus operating complexity. Durable queues improve recovery while requiring migration, cleanup, cancellation, and account-lifecycle rules. For a small foreground-only workflow, a simpler approach may be appropriate if it still preserves unsent work honestly.
The Social App portfolio page provides related mobile and offline context. This photo queue is fictional and includes no battery, throughput, or reliability measurement.
Questions about upload retry queues
Should every server error retry forever?
No. Classify the failure and define when intervention or a final state is required. Endless retries can hide permanent defects.
Can manual retry ignore the old attempt?
It should preserve the logical operation and resolve uncertain completion. Otherwise, one user action can create duplicates.
What should a regression case assert?
Assert ownership, local durability, scheduling state, remote identity, duplicate effects, and cleanup. Bring ambiguous states to an upload-queue review.