-
Notifications
You must be signed in to change notification settings - Fork 12
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: adding delta_reset_ms to TAKE and TAKEELEVATED responses #80
Conversation
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.
Tentatively approving - only semi-blocking thing would be the question about the test where + 1800
is added in a previous assert
@@ -446,6 +450,7 @@ module.exports.tests = (clientCreator) => { | |||
assert.ok(result.conformant); | |||
assert.equal(result.remaining, 0); | |||
assert.closeTo(result.reset, now / 1000 + 1800, 1); |
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.
Curious why they added an extra 1800 here (maybe because of an override?)
Wondering whether we should consider and incorporate it for delta_reset_ms
assertion too
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.
the bucket is configured at 2 tokens per hour. As it's a sliding window it calculates it needs to add 1 token every 30 minutes (1800 secs).
And it's indirectly set in the delta_reset_ms. After the calculations, it'll be 1800 secs as well.
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.
I still don't fully understand why we are considering "half an hour" here. Can we :watercooler: on it after this sometime?
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.
Unless you have a good way to describe it in text. :D
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Adds a new
delta_reset_ms
response attribute to TAKE and TAKEELEVATED, to indicate the number of ms until the bucket resets. Unlike thereset
attribute which represents a unix timestamp, this attribute represents a delta from the current time expressed in ms in order to avoid clock skew issues.Testing
Checklist