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

[payment] prune reservation periods and ondemand payments #994

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

hopeyen
Copy link
Contributor

@hopeyen hopeyen commented Dec 12, 2024

Why are these changes needed?

To avoid db from infinitely growing, we prune reservations and ondemand records

reservations are pruned periodically with a goroutine similar to refreshing onchain state, as it operates based on time. The frequency is set as a configuration to the offchain store
ondemands are pruned every time a ondemand request is served, with a hardcoded constant which is 100 for each account, this can also be a configuration

also contains some renaming of binRecord to reservationPeriodRecord, and refactoring refreshOnchainState function

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@hopeyen hopeyen force-pushed the hope/prune-expired-bins branch from ba70e4a to 92a169d Compare December 12, 2024 21:55
@hopeyen hopeyen force-pushed the hope/prune-expired-bins branch from 92a169d to 3956bc0 Compare December 12, 2024 21:55
@hopeyen hopeyen requested a review from ian-shim December 12, 2024 22:08
Copy link
Contributor

@ian-shim ian-shim left a comment

Choose a reason for hiding this comment

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

Instead of actively kicking off pruning logic, can we set a TTL for these records and enforce pruning from dynamodb directly?

@hopeyen
Copy link
Contributor Author

hopeyen commented Dec 12, 2024

Instead of actively kicking off pruning logic, can we set a TTL for these records and enforce pruning from dynamodb directly?

Yes that makes sense, I will try!

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