about summary refs log tree commit homepage
path: root/lib/yahns/queue_epoll.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/queue_epoll.rb')
-rw-r--r--lib/yahns/queue_epoll.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb
index 1813581..7df1cc0 100644
--- a/lib/yahns/queue_epoll.rb
+++ b/lib/yahns/queue_epoll.rb
@@ -46,7 +46,8 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc:
           end
         end
       rescue => e
-        break if closed?
+        # sleep since this check is racy (and uncommon)
+        break if closed? || (sleep(0.01) && closed?)
         Yahns::Log.exception(logger, 'queue loop', e)
       end while true
     end