specwrk 0.21.2 → 0.21.3
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/CHANGELOG.md +5 -1
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/endpoints/popable.rb +8 -3
- data/lib/specwrk/worker.rb +5 -2
- 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: 82780e6ddeb47d5bc80b841b15de243dee0419cf5b60e4d93412053384936dab
|
|
4
|
+
data.tar.gz: 82b3ae57d195ddb56544f240825e132eb95c251bbb160463d7afe2d03c4c3713
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e684e17c0a0678993dac9632bb0a2d1c5821d0d9eb0ed9153e78eb03b682455f29f159101456348c91af5be6ebccf1816f7f1d956a75d1bf1d2f6b375daf08d1
|
|
7
|
+
data.tar.gz: 98f18857a73b0fe7162b7ca357fd82cc0a47e769e683f68256b51d4a103e2eb086a523256f74a13a876b2b89b04bbb9166c01c12776b50ceb824521cb9886922
|
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
|
-
[Compare](https://github.com/danielwestendorf/specwrk/compare/v0.21.
|
|
4
|
+
[Compare](https://github.com/danielwestendorf/specwrk/compare/v0.21.3...main)
|
|
5
|
+
|
|
6
|
+
## v0.21.3 — 2026-10-11
|
|
7
|
+
[Compare](https://github.com/danielwestendorf/specwrk/compare/v0.21.2...v0.21.3)
|
|
8
|
+
- Make worker heartbeat intervals and expiration timeouts configurable — [#198](https://github.com/danielwestendorf/specwrk/pull/198) by [@danielwestendorf](https://github.com/danielwestendorf)
|
|
5
9
|
|
|
6
10
|
## v0.21.2 — 2026-10-10
|
|
7
11
|
[Compare](https://github.com/danielwestendorf/specwrk/compare/v0.21.1...v0.21.2)
|
data/lib/specwrk/version.rb
CHANGED
|
@@ -59,13 +59,18 @@ module Specwrk
|
|
|
59
59
|
@expired_examples ||= processing.to_h.select { |_id, example| expired?(example) }
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
# Has the worker missed
|
|
62
|
+
# Has the worker missed its configured heartbeat timeout?
|
|
63
63
|
def expired?(example)
|
|
64
64
|
return false unless example[:worker_id]
|
|
65
65
|
return false unless example[:processing_started_at]
|
|
66
|
-
return false unless example[:processing_started_at] < (Time.now - 20).to_i
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
timeout = Integer(ENV.fetch("SPECWRK_WORKER_HEARTBEAT_TIMEOUT", "60"))
|
|
68
|
+
raise ArgumentError, "SPECWRK_WORKER_HEARTBEAT_TIMEOUT must be greater than 0" unless timeout.positive?
|
|
69
|
+
|
|
70
|
+
cutoff = Time.now - timeout
|
|
71
|
+
return false unless example[:processing_started_at] < cutoff.to_i
|
|
72
|
+
|
|
73
|
+
workers_last_heartbeats[example[:worker_id]] < cutoff
|
|
69
74
|
end
|
|
70
75
|
|
|
71
76
|
def workers_last_heartbeats
|
data/lib/specwrk/worker.rb
CHANGED
|
@@ -97,11 +97,14 @@ module Specwrk
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def thump
|
|
100
|
+
heartbeat_interval = Integer(ENV.fetch("SPECWRK_HEARTBEAT_INTERVAL", "5"))
|
|
101
|
+
raise ArgumentError, "SPECWRK_HEARTBEAT_INTERVAL must be greater than 0" unless heartbeat_interval.positive?
|
|
102
|
+
|
|
100
103
|
while running && !Specwrk.force_quit
|
|
101
|
-
sleep
|
|
104
|
+
sleep heartbeat_interval
|
|
102
105
|
|
|
103
106
|
begin
|
|
104
|
-
client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now -
|
|
107
|
+
client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now - heartbeat_interval + 1
|
|
105
108
|
rescue
|
|
106
109
|
warn "Heartbeat failed!"
|
|
107
110
|
end
|