I'm trying to run a really simple test: ```ruby require "async" describe "async" do it "tests async" do task = Async do sleep(100) end task.stop puts "done" end end ``` This should return instantly right? why does the test take 100sec to run? i'm sorry if this is really obvious im on: - ruby: 3.3.4 - async: 2.21.1 - io-event: 1.7.4
Activity
ioquatix commentedon Nov 29, 2024
A top level async task is blocking as there is no way the sleep can execute while continuing to execute the code outside the event loop.
You should run your entire test inside an event, e.g.
If you are using Sus you can use
sus-fixtures-asyncand write it like this:The reactor context also adds a 60s timeout to the code to ensure your tests aren't hanging.