Skip to content

Conversation

@PhilBastian
Copy link
Contributor

part of #1905, extending #2675 to remove direct SC calls from views

}
watch(autoRefreshValue, (newValue) => {
updateInterval(newValue || 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you modified updateInterval to do the pause and resume as part of the internals, I don't think we need the if/else statement at all here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the if statement, there would be nothing to call start when going from 0 to >0. This has made me realise, however, that the updateInterval will potentially resume before start is ever called

constructor(store?: ServiceControlStore) {
//this module is only called from within view setup or other pinia stores, so this call is lifecycle safe
this.serviceControlStore = useServiceControlStore();
this.serviceControlStore = store ?? useServiceControlStore();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given useServiceControlStore() is a singleton, do we need to pass it in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a singleton, but pinia ensures that the same store is injected for each call. This seems safer, given we don't control where in the lifecycle this class is constructed

Comment on lines +90 to 100
watch(isRefreshing, () => {
// If we're currently polling at 5 seconds and there is a restore in progress, then change the polling interval to poll every 1 second
if (!pollingFaster && isRestoreInProgress()) {
pollingFaster = true;
updateInterval(1000);
} else if (pollingFaster && !isRestoreInProgress()) {
// if we're currently polling every 1 second and all restores are done, change polling frequency back to every 5 seconds
pollingFaster = false;
updateInterval(5000);
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something feels off here. Why are we updating the interval on the isRefreshing watch?
The interval is already updated when we call restoreGroup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I decided to rewrite this, see #2717

Base automatically changed from message_store_initialisation to monitoring_store November 24, 2025 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants