Skip to content

Commit

Permalink
feat: Respect parallel count config
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 17, 2024
1 parent b73b7a2 commit ad600bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export enum Status {
PAUSED = 2
}

// Maximum number of concurrent uploads
const MAX_CONCURRENCY = 5

export class Uploader {

// Initialized via setter in the constructor
Expand All @@ -41,7 +38,10 @@ export class Uploader {

// Global upload queue
private _uploadQueue: Array<Upload> = []
private _jobQueue: PQueue = new PQueue({ concurrency: MAX_CONCURRENCY })
private _jobQueue: PQueue = new PQueue({
// Maximum number of concurrent uploads
concurrency: window.OC?.appConfig?.files?.max_parallel_count ?? 5,
})
private _queueSize = 0
private _queueProgress = 0
private _queueStatus: Status = Status.IDLE
Expand Down
1 change: 1 addition & 0 deletions lib/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ declare global {
appConfig: {
files: {
max_chunk_size: number
max_parallel_count?: number
}
}
}
Expand Down

0 comments on commit ad600bc

Please sign in to comment.