Skip to content

Commit

Permalink
Revert "don't close socket when pausing"
Browse files Browse the repository at this point in the history
This reverts commit e4dbe77.
  • Loading branch information
mifi committed Dec 12, 2023
1 parent 7f8d138 commit 6c22e0e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/@uppy/companion-client/src/RequestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class RequestClient {
return stripSlash(companion && companion[host] ? companion[host] : host)
}

async headers(emptyBody = false) {
async headers (emptyBody = false) {
const defaultHeaders = {
Accept: 'application/json',
...(emptyBody ? undefined : {
Expand Down Expand Up @@ -397,6 +397,15 @@ export default class RequestClient {

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) => {
Expand Down

0 comments on commit 6c22e0e

Please sign in to comment.