Only show throttling warning when throttling happened. (#1976)

This commit is contained in:
Laurent Nguyen 2024-09-23 17:30:42 +02:00 committed by GitHub
parent 053dc9d76b
commit 7128133874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 9 deletions

View File

@ -645,6 +645,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
throttledIds: DocumentId[];
failedIds: DocumentId[];
beforeExecuteMs: number; // Delay before executing delete. Used for retrying throttling after a specified delay
hasBeenThrottled: boolean; // Keep track if the operation has been throttled at least once
}>(undefined);
const [bulkDeleteOperation, setBulkDeleteOperation] = useState<{
onCompleted: (documentIds: DocumentId[]) => void;
@ -754,6 +755,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
throttledIds: newThrottled,
failedIds: prev.failedIds.concat(newFailed),
beforeExecuteMs: retryAfterMilliseconds,
hasBeenThrottled: prev.hasBeenThrottled || newThrottled.length > 0,
}));
})
.catch((error) => {
@ -764,6 +766,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
successfulIds: prev.successfulIds,
failedIds: prev.failedIds.concat(prev.pendingIds),
beforeExecuteMs: undefined,
hasBeenThrottled: prev.hasBeenThrottled,
}));
bulkDeleteOperation.onFailed(error);
});
@ -1142,6 +1145,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
successfulIds: [],
failedIds: [],
beforeExecuteMs: 0,
hasBeenThrottled: false,
});
setIsBulkDeleteDialogOpen(true);
setBulkDeleteMode("inProgress");
@ -2312,15 +2316,17 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
</MessageBarBody>
</MessageBar>
)}
<MessageBar intent="warning">
<MessageBarBody>
<MessageBarTitle>Warning</MessageBarTitle>
{get429WarningMessageNoSql()}{" "}
<Link href={NO_SQL_THROTTLING_DOC_URL} target="_blank">
Learn More
</Link>
</MessageBarBody>
</MessageBar>
{bulkDeleteProcess.hasBeenThrottled && (
<MessageBar intent="warning">
<MessageBarBody>
<MessageBarTitle>Warning</MessageBarTitle>
{get429WarningMessageNoSql()}{" "}
<Link href={NO_SQL_THROTTLING_DOC_URL} target="_blank">
Learn More
</Link>
</MessageBarBody>
</MessageBar>
)}
</div>
</ProgressModalDialog>
)}