-
Notifications
You must be signed in to change notification settings - Fork 211
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
CNS-315: implement subscription renewal #352
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
orenl-lava
force-pushed
the
CNS-315-subscription-renewal
branch
6 times, most recently
from
March 14, 2023 04:29
bc7c274
to
c96d2d0
Compare
Yaroms
requested changes
Mar 14, 2023
orenl-lava
changed the title
CNS 315: implement subscription renewal
CNS-315: implement subscription renewal
Mar 15, 2023
Yaroms
previously approved these changes
Mar 15, 2023
orenl-lava
force-pushed
the
CNS-334-subscription-fixes-tests-and-cli
branch
from
March 15, 2023 17:02
c8f3ff9
to
d6bd5ff
Compare
orenl-lava
force-pushed
the
CNS-315-subscription-renewal
branch
from
March 16, 2023 10:01
abbf102
to
bf12a3e
Compare
orenl-lava
changed the base branch from
CNS-334-subscription-fixes-tests-and-cli
to
main
March 16, 2023 10:02
omerlavanet
requested changes
Mar 16, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dup line, add zero check for duration
Plans always indicate CU limits per month. Therefore, change subscription logic to track remaining CUs monthly: - Keep track of remining duration (in months) - Set expiry always 1 month forward, and then decrement the remaining duration: - if reaches zero: mark for deletion (to allow grace period for payments) - if marked for deleteion: grace period ended, delete the subscription - otherwise, reset remaining CU (to monthly limit as per the plan) - Simplify "1 month forward" to be "same day-of-month next month, but no later than the 28th of that month" (useful to have a stable day-of-month). - Use epochskeeper.BlocksToSave() for the number of blocks to linger until an expired subscription turns stale (instead of time based deadline).
Subscription renewal happens when buying a subscription for a consumer with an existing subscription, with the same plan (index and version). The existing subscription is extended by the new duration requested. The total duration is limited to 1 year, but also 1 additional month to allow renewal with yearly discount before an existing subscription ends.
orenl-lava
force-pushed
the
CNS-315-subscription-renewal
branch
from
March 16, 2023 14:35
7419770
to
8b26eff
Compare
omerlavanet
approved these changes
Mar 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement subscription renewal:
Renewal takes place when buying a subscription for a consumer with an existing subscription, with the same plan (index and version). In this case, the existing subscription gets extended by the (new) duration requested. The total duration is limited to 1 year - and 1 additional month of grace to allow renewal with yearly discount before an existing subscription ends.
The first commit changes subscription logic to track CUs and remaining duration monthly.
The second commit adds support for subscription renewal.
(PR based on branch #351 for https://github.com/lavanet/lava/tree/CNS-334-subscription-fixes-tests-and-cli)