Skip to content

Conversation

@petruki
Copy link
Member

@petruki petruki commented Aug 31, 2025

This pull request introduces a new worker-based system for scheduled cache updates in the src/helpers/cache module. The main goal is to offload periodic cache refresh operations to a background worker thread, improving performance and reliability. The update includes the implementation of a worker manager, the worker itself, integration into the cache class, and new unit tests to verify the functionality.

Worker-based scheduled cache updates:

  • Added a new CacheWorkerManager class (worker-manager.js) that manages a background worker thread for periodic cache updates, including event handling, status tracking, and error management.
  • Implemented a new worker script (worker.js) that connects to the database, checks for domain updates at a configurable interval, and communicates with the main thread to synchronize cache state.
  • Integrated the worker manager into the Cache class (index.js), adding methods to start and stop scheduled updates, handle worker events, and synchronize cache versions between the worker and the main process. [1] [2]

Testing and configuration:

  • Added and updated unit tests in cache.test.js to verify scheduled cache updates, cache version synchronization, and worker lifecycle management. [1] [2] [3]
  • Updated SonarQube configuration to exclude the new worker file from code coverage analysis.

@petruki petruki added this to the v1.1.0 milestone Aug 31, 2025
@petruki petruki self-assigned this Aug 31, 2025
@sonarqubecloud
Copy link

@petruki petruki merged commit 6fc1e2c into master Aug 31, 2025
5 checks passed
@petruki petruki deleted the staging branch August 31, 2025 21:52
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