Web: Files: Upload: moved chunkUploadCount to SettingsStore
This commit is contained in:
parent
fb8712a8c8
commit
772ec79d99
@ -36,6 +36,7 @@ class SettingsStore {
|
||||
keepNewFileName = null;
|
||||
thumbnails1280x720 = window.DocSpaceConfig?.thumbnails1280x720 || false;
|
||||
chunkUploadSize = 1024 * 1023; // 1024 * 1023; //~0.999mb
|
||||
chunkUploadCount = 5;
|
||||
|
||||
settingsIsLoaded = false;
|
||||
|
||||
|
@ -31,9 +31,6 @@ import {
|
||||
getCategoryUrl,
|
||||
} from "SRC_DIR/helpers/utils";
|
||||
|
||||
const UPLOAD_LIMIT_AT_ONCE = 5;
|
||||
const ASYNC_UPLOAD_LIMIT_AT_ONCE = 5;
|
||||
|
||||
class UploadDataStore {
|
||||
authStore;
|
||||
treeFoldersStore;
|
||||
@ -1129,6 +1126,7 @@ class UploadDataStore {
|
||||
operationId,
|
||||
toFolderId
|
||||
) => {
|
||||
const { chunkUploadCount: asyncChunkUploadCount } = this.settingsStore;
|
||||
const length = requestsDataArray.length;
|
||||
|
||||
const isThirdPartyFolder = typeof toFolderId === "string";
|
||||
@ -1160,9 +1158,7 @@ class UploadDataStore {
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
let i =
|
||||
length <= ASYNC_UPLOAD_LIMIT_AT_ONCE
|
||||
? length
|
||||
: ASYNC_UPLOAD_LIMIT_AT_ONCE;
|
||||
length <= asyncChunkUploadCount ? length : asyncChunkUploadCount;
|
||||
while (i !== 0) {
|
||||
this.asyncUpload(
|
||||
t,
|
||||
@ -1226,13 +1222,15 @@ class UploadDataStore {
|
||||
// console.log("IS PARALLEL");
|
||||
const notUploadedFiles = this.files.filter((f) => !f.inAction);
|
||||
|
||||
const { chunkUploadCount } = this.settingsStore;
|
||||
|
||||
const countFiles =
|
||||
notUploadedFiles.length >= UPLOAD_LIMIT_AT_ONCE
|
||||
? UPLOAD_LIMIT_AT_ONCE
|
||||
notUploadedFiles.length >= chunkUploadCount
|
||||
? chunkUploadCount
|
||||
: notUploadedFiles.length;
|
||||
|
||||
for (let i = 0; i < countFiles; i++) {
|
||||
if (this.currentUploadNumber <= UPLOAD_LIMIT_AT_ONCE) {
|
||||
if (this.currentUploadNumber <= chunkUploadCount) {
|
||||
const fileIndex = this.files.findIndex(
|
||||
(f) => f.uniqueId === notUploadedFiles[i].uniqueId
|
||||
);
|
||||
|
@ -180,6 +180,7 @@ export type TFilesSettings = {
|
||||
};
|
||||
canSearchByContent: boolean;
|
||||
chunkUploadSize: number;
|
||||
chunkUploadCount: number;
|
||||
confirmDelete: boolean;
|
||||
convertNotify: boolean;
|
||||
defaultOrder: { is_asc: boolean; property: 1 };
|
||||
|
Loading…
Reference in New Issue
Block a user