From 049225d4ae1b6e39974663ff2c1f83237d06bb74 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Mon, 19 Oct 2020 23:09:48 +0300 Subject: [PATCH] do not create all the photos at once --- frontend/src/redux/photos/sagas.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/redux/photos/sagas.ts b/frontend/src/redux/photos/sagas.ts index 95f8128..809aa82 100644 --- a/frontend/src/redux/photos/sagas.ts +++ b/frontend/src/redux/photos/sagas.ts @@ -172,7 +172,8 @@ function* photoLoad(action: IPhotoLoadStartAction) { function* photoCreate() { const store = yield select(); const photosCreating = store.photos.photosCreating; - if (photosCreating < 2) { + const photosUploadQueue = Object.keys(store.photos.photoUploadQueue).length; + if (photosCreating < 2 && photosUploadQueue < 4) { const createQueue = store.photos.photoCreateQueue as File[]; if (createQueue.length === 0) { return; @@ -292,5 +293,7 @@ export function* photosSaga() { takeEvery(PhotoTypes.PHOTO_UPLOAD_QUEUE, photoUpload), takeEvery(PhotoTypes.PHOTO_UPLOAD_SUCCESS, photoUpload), takeEvery(PhotoTypes.PHOTO_UPLOAD_FAIL, photoUpload), + takeEvery(PhotoTypes.PHOTO_UPLOAD_SUCCESS, photoCreate), + takeEvery(PhotoTypes.PHOTO_UPLOAD_FAIL, photoCreate), ]); }