loga 2.6.0 → 2.6.1

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: 5366cef0d19c0384219e570b910635edeced8c13f7d27a7726f76397de78b492
4
- data.tar.gz: 1015b91450e060ca3d705a93c50decf6111136a51d4819429f3be45f97687e53
3
+ metadata.gz: 1c431f4c2be4360f29975cc8434c86647c77cf8a375bcd8fa6e6a0b47bb8a2e8
4
+ data.tar.gz: 2ec1e76ed48281e99acca8bdc3dd55b3fb6068dee599dd5c4bf92008e1af6eb0
5
5
  SHA512:
6
- metadata.gz: 151f8dddb93eeaf02ed792e45d51e7c694f349d6d397d18602ac6928953844f7047abaf7ae31b681cfa068f75842799d54eb90a948c75cead9e3b2edd1200175
7
- data.tar.gz: 80a2b4f443aaea2403388de748fb181aeea34c81f6e693cc08b50b6b9893a48bcfed447c747d0f241823d99904b28772b64e7495870ac03426b71b0be6991f97
6
+ metadata.gz: 5c09402cb2b8f7e90bb53ccba07df43c759a9d4cea9cd5a19f8fbfcf332b0ce7914dca1d3c085cd43d9d081e40cc2c4d18452bd5c6b44d10e1df2771c7a88146
7
+ data.tar.gz: f9f937d8e0a600c05ca50e60c05b084d6756b76158f2b4dcfc7a070ee30ad535ef2df6f0c10d6f61a99152ec2fa2cdb1815b450ce600e4be72e51e797d1165b6
data/Appraisals CHANGED
@@ -34,6 +34,10 @@ if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.5.0')
34
34
  appraise 'sidekiq6' do
35
35
  gem 'sidekiq', '~> 6.0'
36
36
  end
37
+
38
+ appraise 'sidekiq61' do
39
+ gem 'sidekiq', '~> 6.1.0'
40
+ end
37
41
  end
38
42
 
39
43
  if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.7.0')
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [2.6.1] - 2022-02-22
8
+ ### Fixed
9
+ - Fix compatibility with sidekiq 6.4.1
10
+
7
11
  ## [2.6.0] - 2021-12-22
8
12
  ### Added
9
13
  - Allow using the gem with rails 7
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sidekiq", "~> 6.1.0"
6
+
7
+ group :test do
8
+ gem "simplecov", "~> 0.17.0"
9
+ end
10
+
11
+ gemspec path: "../"
@@ -10,22 +10,27 @@ module Loga
10
10
 
11
11
  yield
12
12
 
13
- with_elapsed_time_context(start) do
14
- loga_log(
15
- message: "#{item['class']} with jid: '#{item['jid']}' done", item: item,
16
- )
17
- end
13
+ ::Sidekiq::Context.current[:elapsed] = elapsed(start)
14
+
15
+ loga_log(message: "#{item['class']} with jid: '#{item['jid']}' done", item: item)
18
16
  rescue Exception => e # rubocop:disable Lint/RescueException
19
- with_elapsed_time_context(start) do
20
- loga_log(
21
- message: "#{item['class']} with jid: '#{item['jid']}' fail", item: item,
22
- exception: e
23
- )
24
- end
17
+ ::Sidekiq::Context.current[:elapsed] = elapsed(start)
18
+
19
+ loga_log(
20
+ message: "#{item['class']} with jid: '#{item['jid']}' fail", item: item,
21
+ exception: e
22
+ )
25
23
 
26
24
  raise
27
25
  end
28
26
 
27
+ def prepare(job_hash, &block)
28
+ super
29
+ ensure
30
+ # For sidekiq version < 6.4
31
+ Thread.current[:sidekiq_context] = nil
32
+ end
33
+
29
34
  private
30
35
 
31
36
  def loga_log(message:, item:, exception: nil)
data/lib/loga/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Loga
2
- VERSION = '2.6.0'.freeze
2
+ VERSION = '2.6.1'.freeze
3
3
  end
@@ -64,6 +64,7 @@ RSpec.describe Loga::Sidekiq6::JobLogger do
64
64
 
65
65
  aggregate_failures do
66
66
  expect(json_line).to include(expected_body)
67
+ expect(json_line['_duration']).to be_a(Float)
67
68
  expect(json_line['timestamp']).to be_a(Float)
68
69
  expect(json_line['host']).to be_a(String)
69
70
  expect(json_line['short_message']).to match(/HardWorker with jid:*/)
@@ -110,6 +111,7 @@ RSpec.describe Loga::Sidekiq6::JobLogger do
110
111
 
111
112
  aggregate_failures do
112
113
  expect(&failed_job).to raise_error(StandardError)
114
+ expect(json_line['_duration']).to be_a(Float)
113
115
  expect(json_line).to include(expected_body)
114
116
  expect(json_line['timestamp']).to be_a(Float)
115
117
  expect(json_line['host']).to be_a(String)
data/spec/spec_helper.rb CHANGED
@@ -37,7 +37,7 @@ when /sidekiq(?<version>\d+)/
37
37
  'spec/loga/sidekiq5/**/*_spec.rb',
38
38
  'spec/loga/sidekiq_spec.rb',
39
39
  ].join(',')
40
- when '6'
40
+ when '6', '61'
41
41
  rspec_pattern = [
42
42
  'spec/integration/sidekiq6_spec.rb',
43
43
  'spec/loga/sidekiq6/**/*_spec.rb',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loga
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Funding Circle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-29 00:00:00.000000000 Z
11
+ date: 2022-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -264,6 +264,7 @@ files:
264
264
  - gemfiles/rails70.gemfile
265
265
  - gemfiles/sidekiq51.gemfile
266
266
  - gemfiles/sidekiq6.gemfile
267
+ - gemfiles/sidekiq61.gemfile
267
268
  - gemfiles/sinatra14.gemfile
268
269
  - gemfiles/unit.gemfile
269
270
  - lib/loga.rb