fix: implemented TD-09, supervised workers now receive shutdowna nd can run cooperative cleanup

This commit is contained in:
2026-06-12 12:19:25 +02:00
parent 8ee2b9a7f7
commit bad656924b
5 changed files with 91 additions and 3 deletions

View File

@@ -66,7 +66,7 @@ defmodule BDS.Scripting.JobRunner do
@impl true
def handle_call(:cancel, _from, state) do
if is_pid(state.task_pid) do
Process.exit(state.task_pid, :kill)
_ = Task.Supervisor.terminate_child(BDS.Scripting.TaskSupervisor, state.task_pid)
end
:ok =

View File

@@ -127,7 +127,7 @@ defmodule BDS.Tasks do
cond do
Map.has_key?(state.running, task_id) ->
%{pid: pid, ref: ref} = state.running[task_id]
Process.exit(pid, :kill)
_ = Task.Supervisor.terminate_child(BDS.Tasks.TaskSupervisor, pid)
next_state =
state