service_skeleton 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +22 -28
- data/.gitignore +0 -7
- data/lib/service_skeleton/ultravisor_loggerstash.rb +9 -1
- data/service_skeleton.gemspec +1 -2
- data/ultravisor/lib/ultravisor/child.rb +4 -4
- data/ultravisor/spec/spec_helper.rb +4 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020137b90b172033166a44e4e8f94094a2cb35f8886a185dbfaa8a47a29cff71
|
4
|
+
data.tar.gz: 85da8294b7d0c158404ef42ffb4969a7f02560ad35b4a5b9713bacbfb50ab9f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d9073b15a24f9b13ffc6bcaa7c60756e425301749fdf6b90e08b132bd7eadeb1ac90c75e0398e2704d57e1bc849edb9ecdfd78270d98b033a51dd7277addc0
|
7
|
+
data.tar.gz: 7cc439b11c6f36df6b2b0282e6f7661ef3c78caa496396ce1260a7d6ab66ccc7aef9a7d5debdd5e38ae2ff74d9833c7bf465f0167d74e7e649b952e882c73858
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,52 +1,46 @@
|
|
1
|
-
name:
|
1
|
+
name: CI
|
2
2
|
|
3
3
|
on:
|
4
4
|
pull_request:
|
5
5
|
push:
|
6
6
|
branches:
|
7
|
-
-
|
8
|
-
tags:
|
9
|
-
- v*
|
7
|
+
- "v1_0"
|
10
8
|
|
11
9
|
jobs:
|
12
10
|
build:
|
13
11
|
runs-on: ubuntu-latest
|
14
|
-
|
12
|
+
|
15
13
|
strategy:
|
16
14
|
matrix:
|
17
|
-
ruby:
|
15
|
+
ruby:
|
16
|
+
- 2.5
|
17
|
+
|
18
18
|
steps:
|
19
19
|
- uses: actions/checkout@v2
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
|
21
|
+
- name: Setup ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
23
|
with:
|
24
24
|
ruby-version: ${{ matrix.ruby }}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
path: vendor/bundle
|
29
|
-
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
30
|
-
restore-keys: |
|
31
|
-
${{ runner.os }}-${{ matrix.ruby }}-gems-
|
32
|
-
- name: Setup gems
|
33
|
-
run: |
|
34
|
-
gem install bundler
|
35
|
-
bundle config path vendor/bundle
|
36
|
-
bundle install --jobs 4
|
37
|
-
- name: Rubocop
|
25
|
+
bundler-cache: true
|
26
|
+
|
27
|
+
- name: Lint
|
38
28
|
run: bundle exec rubocop
|
29
|
+
|
39
30
|
- name: Tests
|
40
|
-
run: bundle exec
|
41
|
-
|
42
|
-
run: bundle exec rspec ultravisor/spec
|
31
|
+
run: bundle exec rake test
|
32
|
+
|
43
33
|
publish:
|
44
|
-
if:
|
34
|
+
if: github.event_name == 'push' && (github.ref == 'refs/heads/v1_0')
|
45
35
|
needs: build
|
46
36
|
runs-on: ubuntu-latest
|
37
|
+
|
47
38
|
steps:
|
48
39
|
- uses: actions/checkout@v2
|
40
|
+
|
49
41
|
- name: Release Gem
|
50
|
-
uses:
|
42
|
+
uses: discourse/publish-rubygems-action@v2-beta
|
51
43
|
env:
|
52
|
-
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
44
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
45
|
+
GIT_EMAIL: team@discourse.org
|
46
|
+
GIT_NAME: discoursebot
|
data/.gitignore
CHANGED
@@ -4,8 +4,16 @@ module ServiceSkeleton
|
|
4
4
|
module UltravisorLoggerstash
|
5
5
|
def logstash_writer
|
6
6
|
#:nocov:
|
7
|
-
@ultravisor[:logstash_writer].unsafe_instance
|
7
|
+
@ultravisor[:logstash_writer].unsafe_instance(wait: false)
|
8
8
|
#:nocov:
|
9
9
|
end
|
10
|
+
|
11
|
+
# logstash_writer will be nil if the logstash_writer worker is not running
|
12
|
+
# Ultravisor's restart policy ensures this will never happen at runtime. But
|
13
|
+
# it does happen during startup and shutdown. In this case, we want to skip
|
14
|
+
# writing to logstash, not block forever. STDOUT logging will continue.
|
15
|
+
def loggerstash_log_message(*args)
|
16
|
+
super if !logstash_writer.nil?
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
data/service_skeleton.gemspec
CHANGED
@@ -185,13 +185,13 @@ class Ultravisor
|
|
185
185
|
!!(@restart == :always || (@restart == :on_failure && termination_exception))
|
186
186
|
end
|
187
187
|
|
188
|
-
def unsafe_instance
|
188
|
+
def unsafe_instance(wait: true)
|
189
189
|
unless @access == :unsafe
|
190
190
|
raise Ultravisor::ThreadSafetyError,
|
191
191
|
"#unsafe_instance called on a child not declared with access: :unsafe"
|
192
192
|
end
|
193
193
|
|
194
|
-
current_instance
|
194
|
+
current_instance(wait: wait)
|
195
195
|
end
|
196
196
|
|
197
197
|
def cast
|
@@ -394,9 +394,9 @@ class Ultravisor
|
|
394
394
|
end
|
395
395
|
end
|
396
396
|
|
397
|
-
def current_instance
|
397
|
+
def current_instance(wait: true)
|
398
398
|
@spawn_m.synchronize do
|
399
|
-
while @instance.nil?
|
399
|
+
while wait && @instance.nil?
|
400
400
|
@spawn_cv.wait(@spawn_m)
|
401
401
|
end
|
402
402
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_skeleton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
- Sam Saffron
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: frankenstein
|
@@ -353,7 +353,7 @@ files:
|
|
353
353
|
homepage: https://github.com/discourse/service_skeleton
|
354
354
|
licenses: []
|
355
355
|
metadata: {}
|
356
|
-
post_install_message:
|
356
|
+
post_install_message:
|
357
357
|
rdoc_options: []
|
358
358
|
require_paths:
|
359
359
|
- lib
|
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
369
|
version: '0'
|
370
370
|
requirements: []
|
371
371
|
rubygems_version: 3.1.4
|
372
|
-
signing_key:
|
372
|
+
signing_key:
|
373
373
|
specification_version: 4
|
374
374
|
summary: The bare bones of a service
|
375
375
|
test_files: []
|