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.
Background
In #76979,
batchResizeImage()inpackages/vips/src/index.tsgenerates multiple thumbnail sizes in a single pass after decoding the source image once viacopyMemory(). It checksinProgressOperations.has( id )between thumbnails andbreaks on cancel: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?
This was raised as a non-blocker during review of #76979:
Acceptance criteria
batchResizeImage(and the upload-media store callers) to match the decision.