Skip to content

Commit

Permalink
don't close socket when pausing (#4821)
Browse files Browse the repository at this point in the history
* don't close socket when pausing

because it prevented us from canceling an upload that is paused
note that we here sacrifice the ability to pause uploads and have other uploads take over the paused upload's rate limit queue spot.
this is sacrificed because we will soon remove the ability to pause/resume uploads anyways

(cherry picked from commit e4dbe77)

* add migration guide entry
  • Loading branch information
mifi authored Jul 8, 2024
1 parent 903d435 commit 7891bf1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions docs/guides/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ case you don’t have to do anything.
- `RequestClient` methods `get`, `post`, `delete` no longer accepts a boolean as
the third argument. Instead, pass `{ skipPostResponse: true | false }`. This
won’t affect you unless you’ve been using `RequestClient`.
- When pausing uploads, the WebSocket towards companion will no longer be
closed. This allows paused uploads to be cancelled, but once a file has been
paused it will still occupy its place in the concurrency queue.

## Migrate from Uppy 3.x to 4.x

Expand Down
9 changes: 0 additions & 9 deletions packages/@uppy/companion-client/src/RequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,6 @@ export default class RequestClient<M extends Meta, B extends Body> {

isPaused = newPausedState
if (socket) sendState()

if (newPausedState) {
// Remove this file from the queue so another file can start in its place.
socketAbortController?.abort?.() // close socket to free up the request for other uploads
} else {
// Resuming an upload should be queued, else you could pause and then
// resume a queued upload to make it skip the queue.
createWebsocket()
}
}

const onFileRemove = (targetFile: UppyFile<M, B>) => {
Expand Down

0 comments on commit 7891bf1

Please sign in to comment.