lepus 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd76ca8d60a80fef01e13aacd4ce59688778fcd00b0d98d448eb252d8ba018f0
4
- data.tar.gz: b934187a671875e0ed1d818b230109f1a3a485fae298125e543a9e5e80936b56
3
+ metadata.gz: bf4a273147ed0ac74a06388815e4910e67a37fd686b3a58272f38fe1ecc8cb9e
4
+ data.tar.gz: 856ae919667b82af10a084f848bcfed8d7035576a2d5b5723b59f8eaa1442f72
5
5
  SHA512:
6
- metadata.gz: 3e6704aa3daea26015095548a93608a3596adaba8b479493bfb43e945a3281171f5164524664768d2e784eb5fe585d1b3c4ea86b57b859f1b7943cc32239342c
7
- data.tar.gz: babc99c5a9de11c5148c64d26599b4a3ce6b6a64296e34b51a31883e9f24622acc02327ea7a0e7cd461336e524f110d8bfb454300e386c0dd054bafabbaec56a
6
+ metadata.gz: 60c7f8c51fe0005339497a951aa6bce64126b8e7281715501d311a74b0e39bf03f2f26c4d6ebbf59127e050e37449d8f9e5761008d254de63c66c542486114d2
7
+ data.tar.gz: 70844794237fa832ac5d39cdb9c9f850ca96e848c9c6f571c4398b2a17e486c59d8228b29276c662db7a6ea4ee8a960d12359a56f6112cc5f5bbc0beaa8e82ea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lepus (0.1.1)
4
+ lepus (0.1.3)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.1.1)
4
+ lepus (0.1.3)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.1.1)
4
+ lepus (0.1.3)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.1.1)
4
+ lepus (0.1.3)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.1.1)
4
+ lepus (0.1.3)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
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"
@@ -58,7 +58,7 @@ module Lepus::Processes
58
58
 
59
59
  def heartbeat
60
60
  process.heartbeat
61
- rescue Process::NotFoundError
61
+ rescue Lepus::Process::NotFoundError
62
62
  self.process = nil
63
63
  interrupt
64
64
  end
data/lib/lepus/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lepus
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/lepus/web.rb CHANGED
@@ -92,7 +92,7 @@ module Lepus
92
92
 
93
93
  def heartbeat
94
94
  process.heartbeat(metrics: metrics_data)
95
- rescue Process::NotFoundError
95
+ rescue Lepus::Process::NotFoundError
96
96
  self.process = nil
97
97
  interrupt
98
98
  end
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.1
4
+ version: 0.1.3
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-04-27 00:00:00.000000000 Z
11
+ date: 2026-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64