Skip to content

Commit

Permalink
Fix node status
Browse files Browse the repository at this point in the history
  • Loading branch information
attdona committed Jan 10, 2024
1 parent f6c982b commit f795c0d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Visor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,11 @@ function start(proc::Process)
return proc.task
end

start() = start(__ROOT__)

function start(sv::Supervisor)
if isrunning(sv)
# start the children
# this supervisor is running but perhaps the children need to be started
startchildren(sv)
return nothing
end
Expand All @@ -468,7 +470,8 @@ function start(sv::Supervisor)
end

function startchain(proc)
if isdefined(proc, :supervisor) && !isdefined(proc.supervisor, :task)
if isdefined(proc, :supervisor) &&
(!isdefined(proc.supervisor, :task) || istaskdone(proc.supervisor.task))
startchain(proc.supervisor)
else
start(proc)
Expand Down Expand Up @@ -552,7 +555,7 @@ function startup(supervisor::Supervisor, proc::Supervised)
add_node(supervisor, proc)

# start now if the supervisor control task is running
if isdefined(supervisor, :task)
if isdefined(supervisor, :task) && !istaskdone(supervisor.task)
start(proc)
end
end
Expand Down Expand Up @@ -781,6 +784,7 @@ function manage(supervisor)
end
end
close(supervisor.inbox)
supervisor.status = idle
end
end

Expand Down Expand Up @@ -857,6 +861,7 @@ function shutdown(node::Process, _reset::Bool=true)
if @isdefined timer
close(timer)
end
node.status = idle
end
end

Expand All @@ -867,6 +872,7 @@ function shutdown(sv::Supervisor, reset::Bool=true)
put!(sv.inbox, Shutdown(; reset=reset))
close(sv.inbox)
wait(sv.task)
sv.status = idle
end
reset && empty!(sv.processes)
return nothing
Expand Down

2 comments on commit f795c0d

@attdona
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99448

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" f795c0d06cbc4241cb1da4691a6c4834ffe9fe55
git push origin v0.3.0

Please sign in to comment.