summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/asyncdispatch.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index b62cf2e9b..42ffa236c 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -1487,7 +1487,7 @@ proc drain*(timeout = 500) =
   ## if there are no pending operations. In contrast to ``poll`` this
   ## processes as many events as are available.
   if runOnce(timeout):
-    while runOnce(0): discard
+    while hasPendingOperations() and runOnce(0): discard
 
 proc poll*(timeout = 500) =
   ## Waits for completion events and processes them. Raises ``ValueError``