5 ms·
I'm not too familiar with ruby/rails, but does this mean the HTTP request just sits open for up to 20 seconds? Is this common/acceptable practice? # user i
by purvis 9y ago
I'm not too familiar with ruby/rails, but does this mean the HTTP request just sits open for up to 20 seconds? Is this common/acceptable practice?
# user is given 20 seconds to approve the request
20.times{
sleep 1
sltoken = REDIS.get("sl:#{state}")
break if sltoken
}
https://github.com/homakov/cobased/blob/master/app/controllers/application_controller.rb#L18 https://github.com/homakov/cobased/blob/master/app/controlle...
- homakov 9y agoIt's not common, but the quickest way I could find to reduce # of roundtrip requests. Happy to hear why unacceptable.
- purvis 9y agoMy initial concern was an aggressive server timeout on nginx/haproxy. I think the defaults should be long enough, but it's entirely possible to have something lower than 20 seconds. (and the app developer might not even be aware of this) I have no reason to think it's unacceptable, was just curious. Interesting project!
- zwily 9y agoIt just means you're tying up a thread (or whole process, if your rails app isn't running with threads) waiting for the response.
- homakov 9y agoIt's not a requirement though: one may ping from the client side with setInterval.