Jatin917/riverside-clone
## 🧠 Improvement Suggestion: Use a Real Queue Structure in IndexedDB
开放
#11 创建于 2025年7月8日
bugenhancementgood first issue
仓库指标
- 星标
- (4 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Description
Currently, the queue object store in IndexedDB is implemented as a flat list of chunk metadata objects. While this works for basic uploads, it lacks true queue behavior — specifically the ability to reorder chunks when upload fails.
Problem
If a chunk fails to upload during processQueue(), it cannot be repositioned at the end of the queue. This results in repeatedly retrying the same chunk first in every cycle, while newer chunks are blocked behind it.
Suggested Enhancement
Use an actual queue-like data structure in IndexedDB, with the ability to:
- Insert new chunks at the end
- Retry failed chunks by moving them to the end
- Maintain order of processing but avoid hard-stopping on failure
Possible Implementation
- Maintain an additional
positionortimestampfield in each queued item - Sort by
positionbefore processing - On upload failure, update
positionto the latest to push it to the back
Benefits
- Reduces bottlenecks from one bad chunk
- Improves overall upload flow and responsiveness
- Prepares system for more intelligent queueing strategies (e.g., retry limits, prioritization)