Skip to content

Commit

Permalink
Restart a process with startup
Browse files Browse the repository at this point in the history
  • Loading branch information
attdona committed Dec 6, 2023
1 parent 74f36aa commit ce16eb4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Visor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ hold(::Supervisor) = nothing

Base.show(io::IO, process::Supervised) = print(io, "$(process.id)")

##function printtree(node::Supervisor)
function dump(node::Supervisor)
children = [
isa(p, Process) ? "$(p.id)($(p.status))" : "supervisor:$(p.id)($(p.status))" for p in values(node.processes)
Expand Down Expand Up @@ -255,7 +254,7 @@ function supervisor(
end

return Supervisor(id,
OrderedDict{String,Supervised}(map(spec -> spec.id => spec, processes)),
OrderedDict{String,Supervised}(map(proc -> proc.id => proc, processes)),
intensity, period, strategy, terminateif)
end

Expand Down Expand Up @@ -496,7 +495,7 @@ function startup(supervisor::Supervisor, proc::Supervised)
yield()
end
if haskey(supervisor.processes, proc.id)
@warn "[$supervisor] already supervisioning proc [$proc]"
@warn "[$supervisor] already supervisioning proc [$proc]" && !istaskdone(supervisor.processes[proc.id].task)
else
call(supervisor, proc)
end
Expand Down Expand Up @@ -555,8 +554,8 @@ function start_processes(

parent.processes[svisor.id] = svisor

for spec in values(procs)
add_node(svisor, spec)
for proc in values(procs)
add_node(svisor, proc)
end
return svisor
end
Expand All @@ -573,8 +572,8 @@ function start_processes(
svisor.strategy = strategy
svisor.terminateif = terminateif

for spec in processes
add_node(svisor, spec)
for proc in processes
add_node(svisor, proc)
end
return svisor
end
Expand Down

0 comments on commit ce16eb4

Please sign in to comment.