Progress
- Opted for a class level design similar to
PluginService, and now thePluginResourceMonitorinstance is created and started at the same levels asPluginService. - The instance of the
PluginResourceMonitornow serves as a daemon for the whole app, related plugin resource consumption data can be fetched from here, from any package, ensuring integrity. - The test app
(app-cli)and the GUI now has coherent data access, resulting in ease of writing tests.
Plans
- Finalising the UI for the plugins and their resources display.
- Writing basic tests for the UI.
- Looking into the alert system, (deferred the development due to priority reassignment).
Problems
- As the data in
PluginResourceMonitoris updated independently, (using asetInterval()that fetched data from the Electron API every 5 secs), the React state needs to be updated separately, this can be done in the following ways:- The most straightforward way is to use another
setInterval()in the Electron App, that syncs the React State variable to the updated monitor service data. - Another way may be to use events to trigger a React State update.
I have yet to determine which one is better in terms of performance, in other cases, the former would be more performance heavy if it had to fetch data every 5 seconds or so, however, here, as the plugin resource usage data is quite small, it may be prudent to just go for the former method. Also, thesetInterval()can be cleared onuseEffect()cleanup.
- The most straightforward way is to use another