Skip to content

add thread-safe tockenbucket touch() function#42

Open
kerolasa wants to merge 1 commit intocloudflare:masterfrom
kerolasa:tockenbucket
Open

add thread-safe tockenbucket touch() function#42
kerolasa wants to merge 1 commit intocloudflare:masterfrom
kerolasa:tockenbucket

Conversation

@kerolasa
Copy link
Copy Markdown
Contributor

Making the touch() thread-safe allows removing external mutex(es) that protect calling the touch.

Unarguably the change also makes the data racing more, but that is fine. With low frequency updates the tocket bucket will not trip over, and with high frequency updates one should not be able to observe off-by-one type of return value distortion when values are stored few jiffies apart.

Signed-off-by: Sami Kerola kerolasa@cloudflare.com

Making the touch() thread-safe allows removing external mutex(es) that
protect calling the touch.

Unarguably the change also makes the data racing more, but that is fine.
With low frequency updates the tocket bucket will not trip over, and with
high frequency updates one should not be able to observe off-by-one type of
return value distortion when values are stored few jiffies apart.

Signed-off-by: Sami Kerola <kerolasa@cloudflare.com>
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.

1 participant