summary refs log tree commit diff stats
path: root/tests/async
diff options
context:
space:
mode:
authorRay Imber <rayimber@gmail.com>2020-06-30 06:23:53 -0700
committerGitHub <noreply@github.com>2020-06-30 15:23:53 +0200
commit36fa79a5242d2e39a83083cd66cf3af9f8931f3b (patch)
treedfb8b8fc2836f7667db2fa4e34c25b9464f2387f /tests/async
parent8be54b8fa7f24fe2886de95c4a2bd356dbae5aa9 (diff)
downloadNim-36fa79a5242d2e39a83083cd66cf3af9f8931f3b.tar.gz
Fix asyncdispatch drain behavior (#14820) (#14838)
* Fix asyncdispatch drain behavior (#14820)

* Changed test to use asyncCheck instead of discard after code review (#14820)

* Added some debug statements to help understand what is happening in Azure.

* Removed debug statements and increased timeouts by 1 order of magnitude to account for slow Azure VMs

Co-authored-by: Ray Imber <ray@crankuptheamps.com>
Diffstat (limited to 'tests/async')
-rw-r--r--tests/async/t14820.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/async/t14820.nim b/tests/async/t14820.nim
new file mode 100644
index 000000000..359884468
--- /dev/null
+++ b/tests/async/t14820.nim
@@ -0,0 +1,25 @@
+discard """
+output: '''
+iteration: 1
+iteration: 2
+iteration: 3
+iteration: 4
+async done
+iteration: 5
+'''
+"""
+
+import asyncdispatch, times
+
+var done = false
+proc somethingAsync() {.async.} =
+  yield sleepAsync 5000
+  echo "async done"
+  done = true
+  
+asyncCheck somethingAsync()
+var count = 0
+while not done:
+  count += 1
+  drain 1000
+  echo "iteration: ", count