Merge pull request #511 from ONLYOFFICE/bugfix/recalculate-quota

bugfix/recalculate-quota
This commit is contained in:
Alexey Safronov 2024-06-21 17:10:03 +04:00 committed by GitHub
commit 91bdaf2ed3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -60,7 +60,7 @@ const StorageManagement = ({
ready && setDocumentTitle(t("Settings:StorageManagement")); ready && setDocumentTitle(t("Settings:StorageManagement"));
}, [ready]); }, [ready]);
if (!isInit || !ready) return <SettingsStorageManagementSkeleton />; if (!ready || !isInit) return <SettingsStorageManagementSkeleton />;
return ( return (
<StyledBody> <StyledBody>

View File

@ -102,6 +102,8 @@ class StorageManagement {
); );
} }
this.needRecalculating = false;
try { try {
if (isInit) this.needRecalculating = await checkRecalculateQuota(); if (isInit) this.needRecalculating = await checkRecalculateQuota();
@ -123,12 +125,16 @@ class StorageManagement {
); );
if (!this.quotaSettings.lastRecalculateDate && isInit) { if (!this.quotaSettings.lastRecalculateDate && isInit) {
this.setIsRecalculating(true);
await recalculateQuota(); await recalculateQuota();
this.getIntervalCheckRecalculate(); this.getIntervalCheckRecalculate();
return; return;
} }
if (this.needRecalculating) this.getIntervalCheckRecalculate(); if (this.needRecalculating) {
this.setIsRecalculating(true);
this.getIntervalCheckRecalculate();
}
} catch (e) { } catch (e) {
toastr.error(e); toastr.error(e);
} }
@ -180,6 +186,9 @@ class StorageManagement {
}; };
getIntervalCheckRecalculate = () => { getIntervalCheckRecalculate = () => {
let isWaitRequest = false; let isWaitRequest = false;
if (this.intervalId) return;
this.intervalId = setInterval(async () => { this.intervalId = setInterval(async () => {
try { try {
if (isWaitRequest) { if (isWaitRequest) {