diff options
Diffstat (limited to 'lib/yahns/acceptor.rb')
-rw-r--r-- | lib/yahns/acceptor.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/acceptor.rb b/lib/yahns/acceptor.rb index 43d5fe8..888e4b6 100644 --- a/lib/yahns/acceptor.rb +++ b/lib/yahns/acceptor.rb @@ -21,7 +21,8 @@ module Yahns::Acceptor # :nodoc: queue.fdmap.desperate_expire_for(self, 5) sleep 1 # let other threads do some work rescue => e - break if closed? + # sleep since this check is racy (and uncommon) + break if closed? || (sleep(0.01) && closed?) Yahns::Log.exception(logger, "accept loop", e) end while true end |