Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 6, 2024
1 parent a7bfec8 commit 67d11ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/async/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def run_once(timeout = nil)
Kernel.raise "Running scheduler on non-blocking fiber!" unless Fiber.blocking?

# If we are finished, we stop the task tree and exit:
if self.finished?
if @children.nil?
return false
end

Expand Down Expand Up @@ -398,9 +398,11 @@ def run(...)
initial_task = self.async(...) if block_given?

self.run_loop do
unless self.finished?
run_once!
if self.finished?
self.stop
end

run_once!
end

return initial_task
Expand Down
2 changes: 1 addition & 1 deletion lib/async/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def completed?

alias complete? completed?

# @attribute [Symbol] The status of the execution of the fiber, one of `:initialized`, `:running`, `:complete`, `:stopped` or `:failed`.
# @attribute [Symbol] The status of the execution of the task, one of `:initialized`, `:running`, `:complete`, `:stopped` or `:failed`.
attr :status

# Begin the execution of the task.
Expand Down

0 comments on commit 67d11ac

Please sign in to comment.