Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

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.
@dafortune dafortune force-pushed the add-non-conformant-stats branch from 6cb8155 to c0ed149 Compare April 19, 2019 18:36
@@ -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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants