lepus 0.1.0 → 0.1.2
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/Gemfile.lock +6 -4
- data/gemfiles/Gemfile.rails-5.2.lock +1 -1
- data/gemfiles/Gemfile.rails-6.1.lock +2 -2
- data/gemfiles/Gemfile.rails-7.2.lock +1 -1
- data/gemfiles/Gemfile.rails-8.0.lock +1 -1
- data/lib/lepus/cli.rb +24 -0
- data/lib/lepus/consumer.rb +9 -1
- data/lib/lepus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 116d40b6e5b9fe75a3d1a97d6a99f73ea17f708d78c3302b2c8d6ea7f1d46b4f
|
|
4
|
+
data.tar.gz: '084d2c433cb8357573484b9750dfb2fad6c2c2e9b3f1ba34304a18a3a7858b17'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fde0c60704a31a5f6686b2344f5489d41111dcb4d1a142e1771941abe9d6ecba60e88cfa5b408697d12ef629289bed5f1e4ebfa9b099c49c41d7d1695aad89b8
|
|
7
|
+
data.tar.gz: 42b3caac7804bfcb060606e4fc2c3f9acd732e2a94e28f6104f9ee6ba29f15d453a9e57530d1076add756e875ba9c57e44b85f9cc836c4db5eb2bf07146474ad
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lepus (0.1.
|
|
4
|
+
lepus (0.1.2)
|
|
5
5
|
base64
|
|
6
6
|
bunny
|
|
7
7
|
concurrent-ruby
|
|
@@ -14,12 +14,13 @@ GEM
|
|
|
14
14
|
specs:
|
|
15
15
|
addressable (2.8.7)
|
|
16
16
|
public_suffix (>= 2.0.2, < 7.0)
|
|
17
|
-
amq-protocol (2.
|
|
17
|
+
amq-protocol (2.7.0)
|
|
18
18
|
ast (2.4.2)
|
|
19
19
|
base64 (0.3.0)
|
|
20
20
|
bigdecimal (3.1.8)
|
|
21
|
-
bunny (
|
|
22
|
-
amq-protocol (~> 2.
|
|
21
|
+
bunny (3.0.0)
|
|
22
|
+
amq-protocol (~> 2.7)
|
|
23
|
+
logger (~> 1, >= 1.7)
|
|
23
24
|
sorted_set (~> 1, >= 1.0.2)
|
|
24
25
|
coderay (1.1.3)
|
|
25
26
|
concurrent-ruby (1.3.6)
|
|
@@ -37,6 +38,7 @@ GEM
|
|
|
37
38
|
json (2.7.5)
|
|
38
39
|
language_server-protocol (3.17.0.3)
|
|
39
40
|
lint_roller (1.1.0)
|
|
41
|
+
logger (1.7.0)
|
|
40
42
|
method_source (1.1.0)
|
|
41
43
|
multi_json (1.15.0)
|
|
42
44
|
parallel (1.26.3)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
lepus (0.1.
|
|
4
|
+
lepus (0.1.2)
|
|
5
5
|
base64
|
|
6
6
|
bunny
|
|
7
7
|
concurrent-ruby
|
|
@@ -73,7 +73,7 @@ GEM
|
|
|
73
73
|
zeitwerk (~> 2.3)
|
|
74
74
|
addressable (2.9.0)
|
|
75
75
|
public_suffix (>= 2.0.2, < 8.0)
|
|
76
|
-
amq-protocol (2.
|
|
76
|
+
amq-protocol (2.8.0)
|
|
77
77
|
ast (2.4.3)
|
|
78
78
|
base64 (0.3.0)
|
|
79
79
|
bigdecimal (4.1.1)
|
data/lib/lepus/cli.rb
CHANGED
|
@@ -31,6 +31,30 @@ module Lepus
|
|
|
31
31
|
Lepus::Supervisor.start(**opts)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
desc "health_check", "Exit 0 if Lepus workers are alive, 1 if unhealthy (for ECS/K8s probes)"
|
|
35
|
+
method_option :threshold, type: :numeric, default: nil,
|
|
36
|
+
desc: "Max seconds since last heartbeat (default: process_alive_threshold)"
|
|
37
|
+
def health_check
|
|
38
|
+
require "lepus"
|
|
39
|
+
|
|
40
|
+
threshold = options[:threshold] || Lepus.config.process_alive_threshold
|
|
41
|
+
cutoff = Time.now - threshold
|
|
42
|
+
|
|
43
|
+
Lepus::ProcessRegistry.start
|
|
44
|
+
alive = Lepus::ProcessRegistry.all.any? { |p| p.last_heartbeat_at.to_i >= cutoff.to_i }
|
|
45
|
+
|
|
46
|
+
if alive
|
|
47
|
+
puts "ok"
|
|
48
|
+
exit 0
|
|
49
|
+
else
|
|
50
|
+
warn "unhealthy: no workers with heartbeat since #{cutoff}"
|
|
51
|
+
exit 1
|
|
52
|
+
end
|
|
53
|
+
rescue => e
|
|
54
|
+
warn "health_check error: #{e.message}"
|
|
55
|
+
exit 1
|
|
56
|
+
end
|
|
57
|
+
|
|
34
58
|
desc "web", "Run Lepus Web dashboard"
|
|
35
59
|
method_option :port, type: :numeric, aliases: "-p", default: 9292, desc: "Port to listen on"
|
|
36
60
|
method_option :host, type: :string, aliases: "-o", default: "0.0.0.0", desc: "Host to bind"
|
data/lib/lepus/consumer.rb
CHANGED
|
@@ -30,9 +30,17 @@ module Lepus
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Returns the middleware chain for this consumer.
|
|
33
|
+
# Inherits middlewares registered on superclasses so abstract base consumers
|
|
34
|
+
# can declare shared middlewares with `use` and have them apply to subclasses.
|
|
33
35
|
# @return [Lepus::Consumers::MiddlewareChain]
|
|
34
36
|
def middleware_chain
|
|
35
|
-
@middleware_chain ||=
|
|
37
|
+
@middleware_chain ||= begin
|
|
38
|
+
chain = Consumers::MiddlewareChain.new
|
|
39
|
+
if superclass.respond_to?(:middleware_chain)
|
|
40
|
+
superclass.middleware_chain.middlewares.each { |m| chain.middlewares << m }
|
|
41
|
+
end
|
|
42
|
+
chain
|
|
43
|
+
end
|
|
36
44
|
end
|
|
37
45
|
|
|
38
46
|
# Registers a middleware to this consumer's chain.
|
data/lib/lepus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lepus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcos G. Zimmermann
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exec
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|