Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cache clearing logic into EventCacheHelper #1928

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

iamacook
Copy link
Member

Summary

Resolves #1926

Our HooksRepository['onEventClearCache'] covers cache clearing based on every event from the Transaction Service and Config. Service and is therefore excessively long. Considering we also have a similar class for notification-enabled hooks, this logic was duplicated.

This adds a new EventCacheHelper, breaking down respective event logic into a separate method. It is then used in both the (non-)event based hook repositories.

Changes

  • Extract cache-related logic to EventCacheHelper
  • Use EventCacheHelper in HooksRepository and HooksRepositoryWithNotifications
  • Update tests accordingly

@iamacook iamacook self-assigned this Sep 16, 2024
@iamacook iamacook requested a review from a team as a code owner September 16, 2024 11:05
@coveralls
Copy link

coveralls commented Sep 16, 2024

Pull Request Test Coverage Report for Build 10937273807

Details

  • 84 of 84 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 90.762%

Totals Coverage Status
Change from base Build 10906426126: 0.1%
Covered Lines: 8312
Relevant Lines: 8784

💛 - Coveralls

@iamacook iamacook merged commit d452a19 into main Sep 19, 2024
18 checks passed
@iamacook iamacook deleted the refactor-hooks-repository branch September 19, 2024 08:35
DenSmolonski pushed a commit to Zilliqa/safe-client-gateway that referenced this pull request Oct 24, 2024
Adds a new `EventCacheHelper`, breaking down respective event logic into a separate method. It is then used in both the (non-)event based hook repositories:

- Extract cache-related logic to `EventCacheHelper`
- Use `EventCacheHelper` in `HooksRepository` and `HooksRepositoryWithNotifications`
- Update tests accordingly
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.

[Tech debt] Refactor HooksRepository to improve readability
3 participants