lex-health 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -19
- data/bitbucket-pipelines.yml +17 -0
- data/{legion-extensions-health.gemspec → lex-health.gemspec} +4 -5
- data/lib/legion/extensions/health.rb +5 -2
- data/lib/legion/extensions/health/runners/health.rb +6 -2
- data/lib/legion/extensions/health/runners/watchdog.rb +8 -2
- data/lib/legion/extensions/health/transport/queues/health.rb +7 -1
- data/lib/legion/extensions/health/version.rb +1 -1
- metadata +8 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a2948d5ad7f73fe45466f8e2394730883aa6516a380560416aae0ded89b7d12
|
4
|
+
data.tar.gz: 0b12a07f49cd1f17e7b09e10ad5dece1e677572cf948c17b62b575084d93d5ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65171ec77699e35c322cb8f372118bd92e908ceb86b61c8a6337cbd083a33973ad81aa5cbdeea86529b3bc63a3e664c90fd024b2b0dcf3b30b7acfedf2719b98
|
7
|
+
data.tar.gz: 7dd6b733d0f7101db17d11e23b15c0be51910505e10cb074c01d24a933098a012553d6e4f743bfe2d5268bea90e2c663ef5ee41fa92c9f1136bae619d610e72f
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lex-health (0.1.
|
4
|
+
lex-health (0.1.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.1)
|
10
|
-
codecov (0.2.
|
10
|
+
codecov (0.2.12)
|
11
11
|
json
|
12
12
|
simplecov
|
13
13
|
diff-lcs (1.4.4)
|
14
14
|
docile (1.3.2)
|
15
15
|
json (2.3.1)
|
16
16
|
parallel (1.19.2)
|
17
|
-
parser (2.7.
|
17
|
+
parser (2.7.2.0)
|
18
18
|
ast (~> 2.4.1)
|
19
19
|
rainbow (3.0.0)
|
20
20
|
rake (13.0.1)
|
21
|
-
regexp_parser (1.
|
21
|
+
regexp_parser (1.8.2)
|
22
22
|
rexml (3.2.4)
|
23
23
|
rspec (3.9.0)
|
24
24
|
rspec-core (~> 3.9.0)
|
25
25
|
rspec-expectations (~> 3.9.0)
|
26
26
|
rspec-mocks (~> 3.9.0)
|
27
|
-
rspec-core (3.9.
|
27
|
+
rspec-core (3.9.3)
|
28
28
|
rspec-support (~> 3.9.3)
|
29
29
|
rspec-expectations (3.9.2)
|
30
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -33,28 +33,25 @@ GEM
|
|
33
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
34
|
rspec-support (~> 3.9.0)
|
35
35
|
rspec-support (3.9.3)
|
36
|
-
rubocop (0.
|
36
|
+
rubocop (0.93.1)
|
37
37
|
parallel (~> 1.10)
|
38
|
-
parser (>= 2.7.1.
|
38
|
+
parser (>= 2.7.1.5)
|
39
39
|
rainbow (>= 2.2.2, < 4.0)
|
40
|
-
regexp_parser (>= 1.
|
40
|
+
regexp_parser (>= 1.8)
|
41
41
|
rexml
|
42
|
-
rubocop-ast (>= 0.
|
42
|
+
rubocop-ast (>= 0.6.0)
|
43
43
|
ruby-progressbar (~> 1.7)
|
44
44
|
unicode-display_width (>= 1.4.0, < 2.0)
|
45
|
-
rubocop-ast (0.
|
46
|
-
parser (>= 2.7.1.
|
47
|
-
rubocop-
|
48
|
-
rubocop (~> 0.60)
|
49
|
-
rubocop-performance (1.7.1)
|
50
|
-
rubocop (>= 0.82.0)
|
51
|
-
rubocop-rspec (1.43.1)
|
45
|
+
rubocop-ast (1.0.0)
|
46
|
+
parser (>= 2.7.1.5)
|
47
|
+
rubocop-rspec (1.44.1)
|
52
48
|
rubocop (~> 0.87)
|
49
|
+
rubocop-ast (>= 0.7.1)
|
53
50
|
ruby-progressbar (1.10.1)
|
54
51
|
simplecov (0.19.0)
|
55
52
|
docile (~> 1.1)
|
56
53
|
simplecov-html (~> 0.11)
|
57
|
-
simplecov-html (0.12.
|
54
|
+
simplecov-html (0.12.3)
|
58
55
|
unicode-display_width (1.7.0)
|
59
56
|
|
60
57
|
PLATFORMS
|
@@ -67,8 +64,6 @@ DEPENDENCIES
|
|
67
64
|
rake
|
68
65
|
rspec
|
69
66
|
rubocop
|
70
|
-
rubocop-md
|
71
|
-
rubocop-performance
|
72
67
|
rubocop-rspec
|
73
68
|
|
74
69
|
BUNDLED WITH
|
@@ -0,0 +1,17 @@
|
|
1
|
+
image: ruby:2.7.0
|
2
|
+
|
3
|
+
pipelines:
|
4
|
+
tags:
|
5
|
+
"v*":
|
6
|
+
- step:
|
7
|
+
name: Push to RubyGems
|
8
|
+
deployment: RubyGems
|
9
|
+
script:
|
10
|
+
- gem install bundler gem-release rake rspec
|
11
|
+
- bundle install
|
12
|
+
- rake build
|
13
|
+
- mkdir .gem
|
14
|
+
- (umask 077 ; echo $gem_creds | base64 --decode > .gem/credentials)
|
15
|
+
- gem release
|
16
|
+
artifacts:
|
17
|
+
- pkg/**
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['matthewdiverson@gmail.com']
|
10
10
|
|
11
11
|
spec.summary = 'Legion::Extensions::Health'
|
12
|
-
spec.description = 'Used to read heartbeats and
|
12
|
+
spec.description = 'Used to read heartbeats and updates the db'
|
13
13
|
spec.homepage = 'https://bitbucket.org/legion-io/lex-health'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
@@ -17,9 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-health'
|
19
19
|
spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-health/CHANGELOG.md'
|
20
|
+
spec.metadata['documentation_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/612171777/LEX+Health'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/612270081/'
|
22
|
+
spec.metadata['bug_tracker_uri'] = 'https://bitbucket.org/legion-io/lex-health/issues'
|
20
23
|
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
24
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
25
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
26
|
end
|
@@ -31,7 +32,5 @@ Gem::Specification.new do |spec|
|
|
31
32
|
spec.add_development_dependency 'rake'
|
32
33
|
spec.add_development_dependency 'rspec'
|
33
34
|
spec.add_development_dependency 'rubocop'
|
34
|
-
spec.add_development_dependency 'rubocop-md'
|
35
|
-
spec.add_development_dependency 'rubocop-performance'
|
36
35
|
spec.add_development_dependency 'rubocop-rspec'
|
37
36
|
end
|
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'legion/extensions/health/version'
|
2
|
-
require 'legion/extensions'
|
3
2
|
|
4
3
|
module Legion
|
5
4
|
module Extensions
|
6
5
|
module Health
|
7
|
-
extend Legion::Extensions::Core
|
6
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
7
|
+
|
8
|
+
def self.data_required?
|
9
|
+
true
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
@@ -4,7 +4,7 @@ module Legion::Extensions::Health
|
|
4
4
|
include Legion::Extensions::Helpers::Lex
|
5
5
|
|
6
6
|
def update(hostname:, **opts)
|
7
|
-
item = Legion::Data::Model::Node
|
7
|
+
item = Legion::Data::Model::Node[name: hostname]
|
8
8
|
|
9
9
|
return { success: insert(hostname: hostname, **opts), hostname: hostname, **opts } if item.nil?
|
10
10
|
|
@@ -16,7 +16,11 @@ module Legion::Extensions::Health
|
|
16
16
|
**opts }
|
17
17
|
end
|
18
18
|
|
19
|
-
{
|
19
|
+
{
|
20
|
+
success: item.update(active: 1, status: opts[:status], name: hostname, updated: Sequel::CURRENT_TIMESTAMP),
|
21
|
+
hostname: hostname,
|
22
|
+
**opts
|
23
|
+
}
|
20
24
|
end
|
21
25
|
|
22
26
|
def insert(hostname:, status: 'unknown', **opts)
|
@@ -5,11 +5,17 @@ module Legion::Extensions::Health
|
|
5
5
|
module Watchdog
|
6
6
|
include Legion::Extensions::Helpers::Lex
|
7
7
|
|
8
|
-
def expire(**_opts)
|
8
|
+
def expire(expire_time: 60, **_opts)
|
9
9
|
nodes = []
|
10
10
|
Legion::Data::Model::Node
|
11
11
|
.where(status: 'healthy')
|
12
|
-
.where(
|
12
|
+
.where(
|
13
|
+
Sequel.lit(
|
14
|
+
"updated <= DATE_SUB(SYSDATE(), INTERVAL #{expire_time} SECOND)
|
15
|
+
OR
|
16
|
+
(updated is null and created <= DATE_SUB(SYSDATE(), INTERVAL #{expire_time} SECOND))"
|
17
|
+
)
|
18
|
+
)
|
13
19
|
.where(active: true)
|
14
20
|
.each do |node|
|
15
21
|
Legion::Transport::Messages::NodeHealth.new(status: 'unknown',
|
@@ -7,7 +7,13 @@ module Legion::Extensions::Health
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def queue_options
|
10
|
-
{
|
10
|
+
{
|
11
|
+
arguments: {
|
12
|
+
'x-single-active-consumer': true,
|
13
|
+
'x-dead-letter-exchange': 'node.dlx'
|
14
|
+
},
|
15
|
+
auto_delete: false
|
16
|
+
}
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lex-health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miverson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,34 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-md
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-performance
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: rubocop-rspec
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +94,7 @@ dependencies:
|
|
122
94
|
- - ">="
|
123
95
|
- !ruby/object:Gem::Version
|
124
96
|
version: '0'
|
125
|
-
description: Used to read heartbeats and
|
97
|
+
description: Used to read heartbeats and updates the db
|
126
98
|
email:
|
127
99
|
- matthewdiverson@gmail.com
|
128
100
|
executables: []
|
@@ -140,7 +112,8 @@ files:
|
|
140
112
|
- Rakefile
|
141
113
|
- bin/console
|
142
114
|
- bin/setup
|
143
|
-
-
|
115
|
+
- bitbucket-pipelines.yml
|
116
|
+
- lex-health.gemspec
|
144
117
|
- lib/legion/extensions/health.rb
|
145
118
|
- lib/legion/extensions/health/actors/health.rb
|
146
119
|
- lib/legion/extensions/health/actors/watchdog.rb
|
@@ -156,7 +129,9 @@ licenses:
|
|
156
129
|
metadata:
|
157
130
|
homepage_uri: https://bitbucket.org/legion-io/lex-health
|
158
131
|
source_code_uri: https://bitbucket.org/legion-io/lex-health
|
159
|
-
changelog_uri: https://
|
132
|
+
changelog_uri: https://legionio.atlassian.net/wiki/spaces/LEX/pages/612270081/
|
133
|
+
documentation_uri: https://legionio.atlassian.net/wiki/spaces/LEX/pages/612171777/LEX+Health
|
134
|
+
bug_tracker_uri: https://bitbucket.org/legion-io/lex-health/issues
|
160
135
|
post_install_message:
|
161
136
|
rdoc_options: []
|
162
137
|
require_paths:
|