-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Adding premium plugin support for updating usage and monitoring quota #1330
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
Conversation
mnorbury
commented
Oct 25, 2023
- Fixing API to match the example usage
- Add a quota monitoring function
| } | ||
|
|
||
| func (qc quotaChecker) startQuotaMonitor(ctx context.Context) (context.Context, func()) { | ||
| newCtx, cancel := context.WithCancel(ctx) |
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.
Typically a cancelable context is created by the caller, but in this case I didn't want to make the caller (plugin developer) have to write this code.
| case <-newCtx.Done(): | ||
| return | ||
| case <-ticker.C: | ||
| hasQuota, err := qc.qm.HasQuota(newCtx) |
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.
Need to add retries to the HasQuota call.
| case <-ticker.C: | ||
| hasQuota, err := qc.qm.HasQuota(newCtx) | ||
| if err != nil { | ||
| continue |
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.
What should we do with an error determining the quota - since returning an error here would cancel the sync.
c089a68 to
84ac02c
Compare
…e parent context is cancelled to perform the final flush
9e3a155 to
4b86abc
Compare
4b86abc to
68aade0
Compare