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

Race condition... #19

Closed
cymen opened this issue Jan 27, 2016 · 2 comments
Closed

Race condition... #19

cymen opened this issue Jan 27, 2016 · 2 comments

Comments

@cymen
Copy link

cymen commented Jan 27, 2016

Is there are reason this doesn't use the built-in redis decr instead of fetch value n then set value n - 1? What if n changes after the get but before the save?

@cymen
Copy link
Author

cymen commented Jan 27, 2016

I'm trying to test this more but it is a bit tricky. I'm seeing odd behavior that makes me suspect this or two nodes with clocks skewed excessively. So I'll keep looking but wanted to understand.

@cymen
Copy link
Author

cymen commented Jan 27, 2016

Ah, I see -- redis.mult()... queues them up to run atomically to avoid the race condition.

@cymen cymen closed this as completed Jan 27, 2016
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

No branches or pull requests

1 participant