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

Add non-conformant-attempts stats #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dafortune
Copy link

Adds stats about the number of times the take operation returned non-conformant
in the past.

Adds stats about the number of times the take operation returned non-conformant
in the past.
@@ -26,17 +26,26 @@ elseif current[1] and tokens_per_ms == 0 then
end

local enough_tokens = new_content >= tokens_to_take
local current_conformant_attempts = current[3] or 0;

Choose a reason for hiding this comment

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

I believe this should be current_non_conformant_attempts.

-- however this approach allows to use a single "HMSET" command instead
-- HINCRBY and "HMSET" which makes the code a bit cleaner and since LUA scripts
-- runs atomically it has the same guarantees as HINCRBY
non_conformant_attempts = current_conformant_attempts + 1

Choose a reason for hiding this comment

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

Should this account for tokens to take?

non_conformant_attempts = current_conformant_attempts + tokens_to_take

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