-
Notifications
You must be signed in to change notification settings - Fork 26
Refactor ConnectionsAndStatsStore responsibility #2737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # src/Frontend/src/components/failedmessages/PendingRetries.vue
| const [response] = await serviceControlClient.fetchTypedFromServiceControl<FailedMessage>(`errors?status=${status}`); | ||
| return parseInt(response.headers.get("Total-Count") ?? "0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const [response] = await serviceControlClient.fetchTypedFromServiceControl<FailedMessage>(`errors?status=${status}`); | |
| return parseInt(response.headers.get("Total-Count") ?? "0"); | |
| return await serviceControlClient.getErrorMessagesCount(status); |
| //Refresh is handled by the autoRefresh setup on the respective views, so doing it here also would cause a double refresh | ||
| //await refresh(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is valuable commentary, since I had a refresh here and only removed it when I realised a double refresh was occurring, at which point I needed to investigate the reason why
| startDate.value = newStartDate; | ||
| [archivedMessageCount.value, pendingRetriesMessageCount.value] = await Promise.all([getErrorMessagesCount(FailedMessageStatus.Archived), getErrorMessagesCount(FailedMessageStatus.RetryIssued)]); | ||
|
|
||
| if (!messageStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're now going to have to clear messageStatus on unloading any views. This seems clunky to me, since the archivedMessageCount and pendingRetriesMessageCount have been placed in this store when they have nothing to do with the rest of the data which is loaded by this store.
IMO this is a worse solution than having it in the connectionandstatsstore with the flag to identify whether to bother fetching it or not
| const showPendingRetry = window.defaultConfig.showPendingRetry; | ||
| const { store: connectionsAndStatsStore } = useConnectionsAndStatsAutoRefresh(); | ||
| connectionsAndStatsStore.requiresFullFailureDetails(); | ||
| const { autoRefresh } = useStoreAutoRefresh("recoverabilityStore", useRecoverabilityStore, 5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this is using useStoreAutoRefresh rather than a singleton version, this will result in two versions of the autorefresh on the recoverability store?
This PR moves archived and pending retry message count tracking from
ConnectionsAndStatsStoretoRecoverabilityStorefor better separation of concerns. TherequiresFullFailureDetails()subscription pattern has been removed -RecoverabilityStorenow fetches these counts directly on each refresh. Additionally, refactoredRecoverabilityStorerefresh function for improved maintainability.