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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebb8c50c54574647ed7dbf76f03f098c84d5169a8e8cdddcefa1ac83ce4c0b9d
4
- data.tar.gz: bfaad63fadbef9fa4bdc95670a438d26267c046783ade5f8ed53a41f70b25dd1
3
+ metadata.gz: 020137b90b172033166a44e4e8f94094a2cb35f8886a185dbfaa8a47a29cff71
4
+ data.tar.gz: 85da8294b7d0c158404ef42ffb4969a7f02560ad35b4a5b9713bacbfb50ab9f4
5
5
  SHA512:
6
- metadata.gz: 546ede76bb2b79949d745cec215f6dac9a7847947dba1bf81d9edcdae947279e4bff5e9d6320b1e3bb4f15d759189c8d2117dc862cf7fe1330167524a404b960
7
- data.tar.gz: d65513d580e112c7393ec4d7ed4c8f2bcec1b30c145d0bd6a60477d943395ccc32bfdfe5146a43e67f4262c81e7704264e7e8ecf2a71e02fe60488ce22ce1fbf
6
+ metadata.gz: 39d9073b15a24f9b13ffc6bcaa7c60756e425301749fdf6b90e08b132bd7eadeb1ac90c75e0398e2704d57e1bc849edb9ecdfd78270d98b033a51dd7277addc0
7
+ data.tar.gz: 7cc439b11c6f36df6b2b0282e6f7661ef3c78caa496396ce1260a7d6ab66ccc7aef9a7d5debdd5e38ae2ff74d9833c7bf465f0167d74e7e649b952e882c73858
@@ -1,52 +1,46 @@
1
- name: Service Skeleton Tests
1
+ name: CI
2
2
 
3
3
  on:
4
4
  pull_request:
5
5
  push:
6
6
  branches:
7
- - master
8
- tags:
9
- - v*
7
+ - "v1_0"
10
8
 
11
9
  jobs:
12
10
  build:
13
11
  runs-on: ubuntu-latest
14
- name: Ruby ${{ matrix.ruby }}
12
+
15
13
  strategy:
16
14
  matrix:
17
- ruby: ["2.5", "2.6", "2.7"]
15
+ ruby:
16
+ - 2.5
17
+
18
18
  steps:
19
19
  - uses: actions/checkout@v2
20
- with:
21
- fetch-depth: 0 # Fetch all history. Needed for `git describe`
22
- - uses: actions/setup-ruby@v1
20
+
21
+ - name: Setup ruby
22
+ uses: ruby/setup-ruby@v1
23
23
  with:
24
24
  ruby-version: ${{ matrix.ruby }}
25
- - name: Bundler cache
26
- uses: actions/cache@v2
27
- with:
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 rspec
41
- - name: Ultravisor Tests
42
- run: bundle exec rspec ultravisor/spec
31
+ run: bundle exec rake test
32
+
43
33
  publish:
44
- if: contains(github.ref, 'refs/tags/v')
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: CvX/publish-rubygems-action@master
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
@@ -1,9 +1,2 @@
1
1
  Gemfile.lock
2
- /pkg
3
- /doc
4
- /.yardoc
5
2
  /coverage
6
- /.bundle
7
- /tmp
8
-
9
- .rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml
@@ -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
@@ -9,8 +9,7 @@ end
9
9
  Gem::Specification.new do |s|
10
10
  s.name = "service_skeleton"
11
11
 
12
- s.version = GVB.version rescue "0.0.0.1.NOGVB"
13
- s.date = GVB.date rescue Time.now.strftime("%Y-%m-%d")
12
+ s.version = '1.0.5'
14
13
 
15
14
  s.platform = Gem::Platform::RUBY
16
15
 
@@ -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
 
@@ -49,4 +49,8 @@ RSpec.configure do |config|
49
49
  config.mock_with :rspec do |mocks|
50
50
  mocks.verify_partial_doubles = true
51
51
  end
52
+
53
+ config.after(:each) do
54
+ Thread.current.name = nil
55
+ end
52
56
  end
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
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-02-01 00:00:00.000000000 Z
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: []