kaplanlior / midburn-queue

midburn.org tickets queue system
https://midburn.org
MIT License
2 stars 5 forks source link

Completely fair queueing #28

Open craig opened 7 years ago

craig commented 7 years ago

I was discussing this with Elad on slack: the queue system doesn't seem to be completely fair. The HTML queue code is making http requests to midburn-queue.herokuapp.com every 10 seconds, but it would be possible to use e.g. Greasemonkey to make your browser do requests a lot more frequently, thus creating a higher chance for you to get a ticket. In order to prevent this, the backend should keep a state of the user and only allow queries every 10 seconds. The database load for doing this might not be too high with redis.

Idea: On the first redirect from the "the queue is not open yet" to the "you're in the queue" site, we would set a cookie and save that one as an "authenticated" cookie. The cookie the user is sending is then used in the key-value store in redis and save the last query time. The server will only redirect to the actual sale if the time difference is >=10 seconds.

yules commented 7 years ago

Thanks @craig - I think we might try something a bit different this time, with less endpoints. The problem was actually that load was twice as much as the last sale, and would probably be more than that on the final sale.