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

feat: Implement resetLimit #2966

Merged
merged 10 commits into from
Sep 17, 2024
Merged

feat: Implement resetLimit #2966

merged 10 commits into from
Sep 17, 2024

Conversation

victor-yanev
Copy link
Contributor

@victor-yanev victor-yanev commented Sep 11, 2024

Description:

Changes:

  • HbarSpendingPlanRepository
    • Added resetAllSpentTodayEntries method.
    • Updated relevant unit tests to cover the new functionality.
    • Enhanced logging for better traceability.
  • HbarLimitService
    • Implemented resetLimiter method
      • it resets the spentToday entry for all spending plans
      • resets the remainingBudget
      • resets the remainingBudgetGauge metrics
      • resets the dailyUniqueSpendingPlansCounter and averageDailySpendingPlanUsagesGauge metrics
      • sets the new reset date to the next day at midnight

Related issue(s):

Fixes #2868

Notes for reviewer:

  • Ensure that the used cache operations are efficient and do not introduce performance bottlenecks.
  • Verify that the logging provides sufficient information for debugging purposes.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
@victor-yanev victor-yanev added the enhancement New feature or request label Sep 11, 2024
@victor-yanev victor-yanev added this to the 0.56.0 milestone Sep 11, 2024
@victor-yanev victor-yanev self-assigned this Sep 11, 2024
Copy link

github-actions bot commented Sep 11, 2024

Tests

       3 files     286 suites   19s ⏱️
1 325 tests 1 324 ✔️ 1 💤 0
1 337 runs  1 336 ✔️ 1 💤 0

Results for commit 60117e7.

♻️ This comment has been updated with latest results.

@victor-yanev victor-yanev marked this pull request as ready for review September 11, 2024 12:21
Copy link

github-actions bot commented Sep 11, 2024

Acceptance Tests

  20 files  284 suites   31m 57s ⏱️
605 tests 594 ✔️ 4 💤 7
910 runs  896 ✔️ 7 💤 7

Results for commit 60117e7.

♻️ This comment has been updated with latest results.

ebadiere
ebadiere previously approved these changes Sep 12, 2024
Copy link
Collaborator

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

Signed-off-by: Eric Badiere <ebadiere@gmail.com>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
@victor-yanev victor-yanev requested review from ebadiere and a team September 16, 2024 10:24
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
ebadiere
ebadiere previously approved these changes Sep 16, 2024
Copy link
Collaborator

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>

# Conflicts:
#	packages/relay/tests/lib/repositories/hbarLimiter/hbarSpendingPlanRepository.spec.ts
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>

# Conflicts:
#	packages/relay/tests/lib/repositories/hbarLimiter/hbarSpendingPlanRepository.spec.ts
konstantinabl
konstantinabl previously approved these changes Sep 17, 2024
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Copy link

sonarcloud bot commented Sep 17, 2024

@ebadiere ebadiere merged commit e5af5c1 into main Sep 17, 2024
39 checks passed
@ebadiere ebadiere deleted the 2868-Implement-resetLimit branch September 17, 2024 13:24
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.52%. Comparing base (e54bb85) to head (60117e7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2966      +/-   ##
==========================================
+ Coverage   89.18%   89.52%   +0.33%     
==========================================
  Files          54       56       +2     
  Lines        3783     3846      +63     
  Branches      774      781       +7     
==========================================
+ Hits         3374     3443      +69     
+ Misses        362      356       -6     
  Partials       47       47              
Flag Coverage Δ
relay 89.65% <100.00%> (+0.05%) ⬆️
server 88.15% <ø> (+0.89%) ⬆️
ws-server 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...sitories/hbarLimiter/hbarSpendingPlanRepository.ts 100.00% <100.00%> (ø)
...s/relay/src/lib/services/hbarLimitService/index.ts 96.39% <100.00%> (+0.39%) ⬆️

... and 4 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HBAR Rate Limit Redesign] Implement resetLimit
3 participants