diffbroker 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/diffbroker/daemon.rb +4 -1
- data/lib/diffbroker/task_runner.rb +12 -0
- data/lib/diffbroker/version.rb +1 -1
- data/plugin/.claude-plugin/plugin.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93366baf36d2624668bda7070960557ef337a5699c80be427798638386adcdda
|
|
4
|
+
data.tar.gz: 0013377ed45686039a4f4eeeae00c995844fdea592a885dfae774d6c1ba9812c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78525e73d46c72bc944a63181b1e86bf774d12d7273d81010a1024b0ea17012f601ff208d3bbbd7d34b3992dd8ddfbeff1d0471abaadf691f047e9411fe5f54f
|
|
7
|
+
data.tar.gz: 3e74c23e1d5091235d00482aa790af5a9b40af3263ff7caf9b5c03e8f9cccee2f1e0c65a5b66ddd15a91353ebfc589e0bf768db9210a2d481a7c1426dc998c7b
|
data/lib/diffbroker/daemon.rb
CHANGED
|
@@ -149,6 +149,7 @@ module Diffbroker
|
|
|
149
149
|
end
|
|
150
150
|
ensure
|
|
151
151
|
if @owner
|
|
152
|
+
@task_runner.interrupt_all! if @task_runner.respond_to?(:interrupt_all!)
|
|
152
153
|
@relay&.stop
|
|
153
154
|
@lifecycle&.clear_pid
|
|
154
155
|
@state&.clear(pid: Process.pid) unless @rejected # a rejected daemon leaves its reason for `status`
|
|
@@ -220,7 +221,9 @@ module Diffbroker
|
|
|
220
221
|
rescan(client)
|
|
221
222
|
@usage_at = nil
|
|
222
223
|
client.perform("hello", "version" => VERSION, "platform" => Diffbroker.platform,
|
|
223
|
-
"service" => @lifecycle ? @lifecycle.service_installed? : false, "agent" => @agent
|
|
224
|
+
"service" => @lifecycle ? @lifecycle.service_installed? : false, "agent" => @agent,
|
|
225
|
+
# What this daemon is running: a run of this device that is missing here was lost with a restart.
|
|
226
|
+
"running" => @running_lock.synchronize { @running.to_a })
|
|
224
227
|
@out.puts "Connected. #{@repositories.size} repositories reported."
|
|
225
228
|
end
|
|
226
229
|
client.on_tick do
|
|
@@ -89,6 +89,16 @@ module Diffbroker
|
|
|
89
89
|
finished(id, "failed", 0, "agent_failed", e.message)
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
# The daemon is ending (stop, restart, upgrade). Its agents end with it, so none keeps working on a session the next companion
|
|
93
|
+
# continues, and nothing is reported as failed: the server hands the lost runs back when the next companion says hello.
|
|
94
|
+
def interrupt_all!
|
|
95
|
+
handles = @lock.synchronize do
|
|
96
|
+
@interrupted = true
|
|
97
|
+
@handles.values
|
|
98
|
+
end
|
|
99
|
+
handles.each { signal("TERM", _1.pid) }
|
|
100
|
+
end
|
|
101
|
+
|
|
92
102
|
# Spec §4.2 step 9: SIGINT to the agent's process group, SIGTERM after the grace period if it is still running.
|
|
93
103
|
def cancel(task_id)
|
|
94
104
|
# A cancel that lands between a verified run's two processes has no handle; remember it so the verifier never starts.
|
|
@@ -288,6 +298,8 @@ module Diffbroker
|
|
|
288
298
|
end
|
|
289
299
|
|
|
290
300
|
def finished(id, status, cost_usd, error_code, last_output)
|
|
301
|
+
return if @lock.synchronize { @interrupted }
|
|
302
|
+
|
|
291
303
|
last = last_output.to_s.lines.last.to_s.strip
|
|
292
304
|
@report.call("finished", { "task_id" => id, "status" => status, "cost_usd" => cost_usd, "error_code" => error_code,
|
|
293
305
|
"last_output" => last[0, MAX_OUTPUT] })
|
data/lib/diffbroker/version.rb
CHANGED