-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Feature] Client Side MediaMedia processing in the browser with WASMMedia processing in the browser with WASM[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Description
Context
Follow-up from PR #74566 comment: #74566 (comment)
The shouldPauseForSideload function in packages/upload-media/src/store/private-actions.ts pauses uploads when another upload to the same post/attachment is already in progress. This was introduced to avoid race conditions when sideloading thumbnails.
Current behavior:
- When sideloading a thumbnail (child item with a
parentId) - If there's already an upload in progress to the same attachment (
additionalData.post) - The upload is paused until the other upload completes
function shouldPauseForSideload(
item: QueueItem,
operation: OperationType | undefined,
select: Selectors
): boolean {
if (
operation !== OperationType.Upload ||
! item.parentId ||
! item.additionalData.post
) {
return false;
}
return select.isUploadingToPost( item.additionalData.post as number );
}Investigation Questions
- Is pausing truly required? What race conditions could occur if concurrent sideloads to the same attachment are allowed?
- REST API handling: Can the WordPress REST API handle concurrent uploads/sideloads to the same attachment safely?
- Performance impact: What is the performance impact of sequential vs parallel thumbnail uploads, especially for bulk uploads (e.g., Gallery block)?
- Alternative approaches: Are there other ways to handle this?
- Request queuing on the server
- Optimistic locking
- Retry logic for conflicts
- Batched sideload endpoint
Expected Outcome
Document whether the pausing mechanism is necessary and, if so, explore alternatives that could improve concurrent upload performance.
Part of #74333
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Client Side MediaMedia processing in the browser with WASMMedia processing in the browser with WASM[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take