Skip to content

Media: Define cancellation semantics for batch thumbnail generation #77246

@adamsilverstein

Description

@adamsilverstein

Background

In #76979, batchResizeImage() in packages/vips/src/index.ts generates multiple thumbnail sizes in a single pass after decoding the source image once via copyMemory(). It checks inProgressOperations.has( id ) between thumbnails and breaks on cancel:

for ( const config of resizes ) {
    // Check cancellation between thumbnails.
    if ( ! inProgressOperations.has( id ) ) {
        break;
    }
    // ... generate thumbnail
}

This means a mid-batch cancel abandons any remaining sizes but keeps whatever was already generated up to that point.

Question

What's the expected user experience when a user cancels an upload partway through batch thumbnail generation?

  • Atomic: abandon all generated thumbnails and leave no partial state.
  • Best-effort: keep the thumbnails already produced and stop processing further sizes (current behavior).
  • Complete: ignore cancellation during the batch loop and let it finish.

This was raised as a non-blocker during review of #76979:

Not a blocker, but I'm wondering a tiny bit about what we want to have happen if a cancellation happens between generating thumbnails. Would we want to abandon them all, or ensure completion of thumbnails? (I.e. how atomic do we want to be?) — @andrewserong

Acceptance criteria

  • Decide on the intended semantics and document them.
  • Update batchResizeImage (and the upload-media store callers) to match the decision.
  • Add a test covering the cancel-mid-batch path.

Metadata

Metadata

Labels

[Feature] Client Side MediaMedia processing in the browser with WASM[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions