Improved Cache Worker Manager handlers #44
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



This pull request refactors the cache worker management system to simplify event handling and improve test coverage. The main changes include replacing setter methods for event handlers with a constructor-based approach, cleaning up redundant error handling, and updating related tests and service functions.
Cache Worker Manager Refactor:
setOnCacheUpdates,setOnCacheDeletions, etc.) inCacheWorkerManagerwith a single constructor parameter that takes all event handlers as an object, simplifying initialization and usage. (src/helpers/cache/worker-manager.js,src/helpers/cache/index.js) [1] [2] [3] [4]src/helpers/cache/worker-manager.js)src/helpers/cache/worker-manager.js)stopmethod for clarity. (src/helpers/cache/worker-manager.js)Domain Service and Worker Updates:
getAllDomainsindomain.jsto accept aselectparameter for more efficient queries, and applied this in the worker to only fetch thelastUpdatefield when refreshing the cache. (src/services/domain.js,src/helpers/cache/worker.js) [1] [2]checkForDeletionsby removing unnecessary try/catch blocks. (src/helpers/cache/worker.js) [1] [2]Testing Improvements:
worker-manager.test.jsto test the lifecycle and error handling ofCacheWorkerManager. (tests/unit-test/cache/worker-manager.test.js)tests/unit-test/cache/cache.test.js) [1] [2] [3] [4] [5] [6]