Skip to content

Conversation

@GeekMasher
Copy link
Contributor

This pull request enhances the UiProvider class in src/providers/uiProvider.ts by introducing safeguards to prevent overlapping scans and fetch operations, improving the user experience and maintaining system stability. The most important changes include adding a _scanInProgress flag, implementing checks for concurrent operations, and ensuring the flag is reset appropriately.

Enhancements to prevent overlapping operations:

  • Added _scanInProgress flag: Introduced a private boolean property _scanInProgress to track whether a scan or fetch operation is currently in progress.

  • Prevented overlapping scans: Updated the runLocalScan method to check the _scanInProgress flag. If a scan is already in progress, a warning is logged, a message is sent to the UI, and an error notification is displayed to the user.

  • Handled concurrent fetch attempts: Modified the fetchRemoteAlerts method to include a similar check for the _scanInProgress flag, ensuring that fetch operations cannot start during an active scan.

  • Reset _scanInProgress flag: Ensured that the _scanInProgress flag is reset in the finally block of both runLocalScan and fetchRemoteAlerts, regardless of whether the operation succeeds or fails. [1] [2]

Minor UI adjustment:

  • Removed redundant HTML closing tag: Cleaned up the HTML structure in the UiProvider's webview by removing an unnecessary closing </div> tag.

@GeekMasher GeekMasher requested a review from Copilot June 27, 2025 09:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the user experience by preventing overlapping scans and fetch operations in the UiProvider class, ensuring system stability through proper state management and user notifications. Key changes include adding a _scanInProgress flag to block concurrent operations, updating runLocalScan and fetchRemoteAlerts to use this flag, and cleaning up the UI webview HTML by removing an extra closing tag.

Comments suppressed due to low confidence (1)

src/providers/uiProvider.ts:503

  • Review the usage of _scanInProgress to ensure its naming and dual role for both scanning and fetching operations clearly reflects its purpose; consider using separate flags if distinct behavior is desired in the future.
    this._scanInProgress = true;

@GeekMasher GeekMasher merged commit ef0c480 into main Jun 27, 2025
1 check passed
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.

2 participants