Bug 69255 - Files.Uploads. Request failed with status code 429

This commit is contained in:
Nikita Gopienko 2024-07-19 15:10:45 +03:00
parent d7de9fe891
commit e82fedc10d
3 changed files with 14 additions and 9 deletions

View File

@ -69,7 +69,8 @@ class FilesSettingsStore {
openEditorInSameTab = null;
thumbnails1280x720 = window.ClientConfig?.thumbnails1280x720 || false;
chunkUploadSize = 1024 * 1023; // 1024 * 1023; //~0.999mb
chunkUploadCount = 5;
maxUploadThreadCount = 15;
maxUploadFilesCount = 5;
settingsIsLoaded = false;
@ -122,6 +123,10 @@ class FilesSettingsStore {
this.settingsIsLoaded = isLoaded;
};
get uploadThreadCount() {
return this.maxUploadThreadCount / this.maxUploadFilesCount;
}
get isLoadedSettingsTree() {
return (
this.confirmDelete !== null &&

View File

@ -1173,7 +1173,7 @@ class UploadDataStore {
operationId,
toFolderId,
) => {
const { chunkUploadCount: asyncChunkUploadCount } = this.filesSettingsStore;
const { uploadThreadCount } = this.filesSettingsStore;
const length = requestsDataArray.length;
const isThirdPartyFolder = typeof toFolderId === "string";
@ -1204,8 +1204,7 @@ class UploadDataStore {
}
const promise = new Promise((resolve, reject) => {
let i =
length <= asyncChunkUploadCount ? length : asyncChunkUploadCount;
let i = length <= uploadThreadCount ? length : uploadThreadCount;
while (i !== 0) {
this.asyncUpload(
t,
@ -1269,15 +1268,15 @@ class UploadDataStore {
// console.log("IS PARALLEL");
const notUploadedFiles = this.files.filter((f) => !f.inAction);
const { chunkUploadCount } = this.filesSettingsStore;
const { maxUploadFilesCount } = this.filesSettingsStore;
const countFiles =
notUploadedFiles.length >= chunkUploadCount
? chunkUploadCount
notUploadedFiles.length >= maxUploadFilesCount
? maxUploadFilesCount
: notUploadedFiles.length;
for (let i = 0; i < countFiles; i++) {
if (this.currentUploadNumber <= chunkUploadCount) {
if (this.currentUploadNumber <= maxUploadFilesCount) {
const fileIndex = this.files.findIndex(
(f) => f.uniqueId === notUploadedFiles[i].uniqueId,
);

View File

@ -240,7 +240,8 @@ export type TFilesSettings = {
};
canSearchByContent: boolean;
chunkUploadSize: number;
chunkUploadCount: number;
maxUploadThreadCount: number;
maxUploadFilesCount: number;
confirmDelete: boolean;
convertNotify: boolean;
defaultOrder: { is_asc: boolean; property: 1 };