Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Ignore vote button clicks while a previous vote is being processed #251

Closed happy-river closed 3 years ago

happy-river commented 3 years ago

Make the race condition described in #250 less likely by changing the JS code which handles clicks on the upvote and downvote buttons to not send a new post request before the previous one has completed.

I was able to reproduce the race condition on my dev server after adding 5 calls to gevent.sleep(0.1) sprinkled throughout cast_vote in misc.py. I tested this change against the modified cast_vote and could not reproduce the vote counting error.