# Report 3: Coding Week 3

**URL:** <https://discourse.joplinapp.org/t/report-3-coding-week-3/38760>\
**Category:** Plugin Monitor\
**Tags:** weekly, report\
**Created:** [25 June 2024 13:17 UTC](https://discourse.joplinapp.org/t/report-3-coding-week-3/38760 "2024-06-25T13:17:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarkFalc0n](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/darkfalc0n/32/20915_2.png) [@DarkFalc0n](https://discourse.joplinapp.org/u/DarkFalc0n)\
**Post date:** [25 June 2024 13:17 UTC](https://discourse.joplinapp.org/t/report-3-coding-week-3/38760/1 "2024-06-25T13:17:27Z")

</div>

## Progress

- Opted for a class level design similar to `PluginService`, and now the `PluginResourceMonitor` instance is created and started at the same levels as `PluginService`.
- The instance of the `PluginResourceMonitor` now 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 `PluginResourceMonitor` is updated independently, (using a `setInterval()` 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, the `setInterval()` can be cleared on `useEffect()` cleanup.
