Skip to content

Commit

Permalink
Only show throttling warning when throttling happened. (#1976)
Browse files Browse the repository at this point in the history
  • Loading branch information
languy authored Sep 23, 2024
1 parent 053dc9d commit 7128133
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand All @@ -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);
});
Expand Down Expand Up @@ -1142,6 +1145,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
successfulIds: [],
failedIds: [],
beforeExecuteMs: 0,
hasBeenThrottled: false,
});
setIsBulkDeleteDialogOpen(true);
setBulkDeleteMode("inProgress");
Expand Down Expand Up @@ -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>
)}
Expand Down

0 comments on commit 7128133

Please sign in to comment.