lib/async/scheduler.rb in async-2.2.1 vs lib/async/scheduler.rb in async-2.3.0
- old
+ new
@@ -32,9 +32,15 @@
@blocked = 0
@timers = ::Timers::Group.new
end
+ def scheduler_close
+ self.run
+ ensure
+ self.close
+ end
+
# @public Since `stable-v1`.
def close
# This is a critical step. Because tasks could be stored as instance variables, and since the reactor is (probably) going out of scope, we need to ensure they are stopped. Otherwise, the tasks will belong to a reactor that will never run again and are not stopped.
self.terminate