karafka-sidekiq-backend 1.4.3 → 1.4.6

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: df894f5849e760cf4fc34d38606fed44f0fef045336fd316b5a67af6f949a264
4
- data.tar.gz: d2f26478a4ce8ff38423faf55874ed6f5127ce2895dd8907fc0559f008f8564c
3
+ metadata.gz: 0cb88351e03ddacb161235d09b97c5af053c32534a52655c916c8a2b01da4ed6
4
+ data.tar.gz: 4549af8841e8921cc65745c5c6ebd5d9a8cd1ace26735c83b24882b51db62b07
5
5
  SHA512:
6
- metadata.gz: 8fe7c353bce5b28ab7abf84136d7a0550387627a036c4a9f90e8bd567441931c765f48781f282cc74a0f47f23df91c80b605f614bcfab917ccd2c002a8471cfa
7
- data.tar.gz: 1d7764a08a7c407457762acb6c84110c5ef43cd3f630d7d89d284629cb76d2bf0bfef98bf3587020c3ce640b85428b27830bb86737569a29cf946d4211b848b9
6
+ metadata.gz: f13198ce14db272f25922d82d135b6964eb23a0c3baeb873f846b25419f0816544ae5cbad1829bb4fa15956a5cbced7032193c5172ce3149f729ef48a4344e69
7
+ data.tar.gz: 57d62c62b5e24d3ffa5476d95094d4a93e9701aba7953d2a09e43a5a6f4d1901c54eb0e69c53f8e0df8e944eafe61dbcd285b913eff24af0d594ac84ed940351
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,5 +1,7 @@
1
1
  name: ci
2
2
 
3
+ concurrency: ci-${{ github.ref }}
4
+
3
5
  on:
4
6
  pull_request:
5
7
  push:
@@ -14,12 +16,11 @@ jobs:
14
16
  fail-fast: false
15
17
  matrix:
16
18
  ruby:
19
+ - '3.1'
17
20
  - '3.0'
18
21
  - '2.7'
19
- - '2.6'
20
- - 'jruby-9.3.1.0'
21
22
  include:
22
- - ruby: '3.0'
23
+ - ruby: '3.1'
23
24
  coverage: 'true'
24
25
  steps:
25
26
  - uses: actions/checkout@v2
@@ -51,7 +52,7 @@ jobs:
51
52
  - name: Set up Ruby
52
53
  uses: ruby/setup-ruby@v1
53
54
  with:
54
- ruby-version: 3.0
55
+ ruby-version: 3.1
55
56
  - name: Install latest bundler
56
57
  run: gem install bundler --no-document
57
58
  - name: Install Diffend plugin
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.3
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Karafka Sidekiq Backend
2
2
 
3
+ ## 1.4.6 (2022-04-17)
4
+ - Add `rubygems_mfa_required`
5
+
6
+ ## 1.4.5 (2022-03-14)
7
+ - Fix Hash#except usage (barthez)
8
+
9
+ ## 1.4.4 (2022-03-06)
10
+ - Ruby 3.1 support
11
+ - Drop support for Ruby 2.6
12
+ - Fix unsafe JSON serialization issued by Sidekiq (#122)
13
+ - Provide sub-second precision for data processed in Sidekiq
14
+
3
15
  ## 1.4.3 (2021-12-05)
4
16
  - Source code metadata url added to the gemspec
5
17
 
data/Gemfile.lock CHANGED
@@ -1,23 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-sidekiq-backend (1.4.3)
4
+ karafka-sidekiq-backend (1.4.6)
5
5
  karafka (~> 1.4.0)
6
6
  sidekiq (>= 4.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- concurrent-ruby (1.1.9)
11
+ concurrent-ruby (1.1.10)
12
12
  connection_pool (2.2.5)
13
13
  delivery_boy (1.1.0)
14
14
  king_konf (~> 1.0)
15
15
  ruby-kafka (~> 1.0)
16
- diff-lcs (1.4.4)
16
+ diff-lcs (1.5.0)
17
17
  digest-crc (0.6.4)
18
18
  rake (>= 12.0.0, < 14.0.0)
19
19
  docile (1.4.0)
20
- dry-configurable (0.13.0)
20
+ dry-configurable (0.14.0)
21
21
  concurrent-ruby (~> 1.0)
22
22
  dry-core (~> 0.6)
23
23
  dry-container (0.9.0)
@@ -29,7 +29,7 @@ GEM
29
29
  concurrent-ruby (~> 1.0)
30
30
  dry-core (~> 0.5, >= 0.5)
31
31
  dry-inflector (0.2.1)
32
- dry-initializer (3.0.4)
32
+ dry-initializer (3.1.1)
33
33
  dry-logic (1.2.0)
34
34
  concurrent-ruby (~> 1.0)
35
35
  dry-core (~> 0.5, >= 0.5)
@@ -37,7 +37,7 @@ GEM
37
37
  dry-configurable (~> 0.13, >= 0.13.0)
38
38
  dry-core (~> 0.5, >= 0.5)
39
39
  dry-events (~> 0.2)
40
- dry-schema (1.8.0)
40
+ dry-schema (1.9.1)
41
41
  concurrent-ruby (~> 1.0)
42
42
  dry-configurable (~> 0.13, >= 0.13.0)
43
43
  dry-core (~> 0.5, >= 0.5)
@@ -50,24 +50,20 @@ GEM
50
50
  dry-core (~> 0.5, >= 0.5)
51
51
  dry-inflector (~> 0.1, >= 0.1.2)
52
52
  dry-logic (~> 1.0, >= 1.0.2)
53
- dry-validation (1.7.0)
53
+ dry-validation (1.8.0)
54
54
  concurrent-ruby (~> 1.0)
55
55
  dry-container (~> 0.7, >= 0.7.1)
56
56
  dry-core (~> 0.5, >= 0.5)
57
57
  dry-initializer (~> 3.0)
58
- dry-schema (~> 1.8, >= 1.8.0)
58
+ dry-schema (~> 1.9, >= 1.9.1)
59
59
  envlogic (1.1.4)
60
60
  dry-inflector (~> 0.1)
61
- io-console (0.5.9)
62
- irb (1.3.7)
63
- reline (>= 0.2.7)
64
- karafka (1.4.11)
61
+ karafka (1.4.13)
65
62
  dry-configurable (~> 0.13)
66
63
  dry-inflector (~> 0.2)
67
64
  dry-monitor (~> 0.5)
68
65
  dry-validation (~> 1.7)
69
66
  envlogic (~> 1.1)
70
- irb (~> 1.3)
71
67
  ruby-kafka (>= 1.3.0)
72
68
  thor (>= 1.1)
73
69
  waterdrop (~> 1.4)
@@ -75,25 +71,23 @@ GEM
75
71
  king_konf (1.0.0)
76
72
  rack (2.2.3)
77
73
  rake (13.0.6)
78
- redis (4.5.1)
79
- reline (0.2.7)
80
- io-console (~> 0.5)
81
- rspec (3.10.0)
82
- rspec-core (~> 3.10.0)
83
- rspec-expectations (~> 3.10.0)
84
- rspec-mocks (~> 3.10.0)
85
- rspec-core (3.10.1)
86
- rspec-support (~> 3.10.0)
87
- rspec-expectations (3.10.1)
74
+ redis (4.6.0)
75
+ rspec (3.11.0)
76
+ rspec-core (~> 3.11.0)
77
+ rspec-expectations (~> 3.11.0)
78
+ rspec-mocks (~> 3.11.0)
79
+ rspec-core (3.11.0)
80
+ rspec-support (~> 3.11.0)
81
+ rspec-expectations (3.11.0)
88
82
  diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.10.0)
90
- rspec-mocks (3.10.2)
83
+ rspec-support (~> 3.11.0)
84
+ rspec-mocks (3.11.1)
91
85
  diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.10.0)
93
- rspec-support (3.10.3)
86
+ rspec-support (~> 3.11.0)
87
+ rspec-support (3.11.0)
94
88
  ruby-kafka (1.4.0)
95
89
  digest-crc
96
- sidekiq (6.3.1)
90
+ sidekiq (6.4.1)
97
91
  connection_pool (>= 2.2.2)
98
92
  rack (~> 2.0)
99
93
  redis (>= 4.2.0)
@@ -102,8 +96,8 @@ GEM
102
96
  simplecov-html (~> 0.11)
103
97
  simplecov_json_formatter (~> 0.1)
104
98
  simplecov-html (0.12.3)
105
- simplecov_json_formatter (0.1.3)
106
- thor (1.1.0)
99
+ simplecov_json_formatter (0.1.4)
100
+ thor (1.2.1)
107
101
  waterdrop (1.4.4)
108
102
  delivery_boy (>= 0.2, < 2.x)
109
103
  dry-configurable (~> 0.13)
@@ -111,10 +105,10 @@ GEM
111
105
  dry-validation (~> 1.7)
112
106
  ruby-kafka (>= 1.3.0)
113
107
  zeitwerk (~> 2.4)
114
- zeitwerk (2.5.1)
108
+ zeitwerk (2.5.4)
115
109
 
116
110
  PLATFORMS
117
- x86_64-darwin
111
+ arm64-darwin-21
118
112
  x86_64-linux
119
113
 
120
114
  DEPENDENCIES
@@ -123,4 +117,4 @@ DEPENDENCIES
123
117
  simplecov
124
118
 
125
119
  BUNDLED WITH
126
- 2.2.32
120
+ 2.3.11
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.add_dependency 'karafka', '~> 1.4.0'
19
19
  spec.add_dependency 'sidekiq', '>= 4.2'
20
- spec.required_ruby_version = '>= 2.6.0'
20
+ spec.required_ruby_version = '>= 2.7'
21
21
 
22
22
  if $PROGRAM_NAME.end_with?('gem')
23
23
  spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
@@ -27,5 +27,9 @@ Gem::Specification.new do |spec|
27
27
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
28
28
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
29
  spec.require_paths = %w[lib]
30
- spec.metadata = { 'source_code_uri' => 'https://github.com/karafka/sidekiq-backend' }
30
+
31
+ spec.metadata = {
32
+ 'source_code_uri' => 'https://github.com/karafka/sidekiq-backend',
33
+ 'rubygems_mfa_required' => 'true'
34
+ }
31
35
  end
@@ -6,7 +6,7 @@ module Karafka
6
6
  # Sidekiq backend that schedules stuff to Sidekiq worker for delayed execution
7
7
  module Sidekiq
8
8
  # Karafka Sidekiq backend version
9
- VERSION = '1.4.3'
9
+ VERSION = '1.4.6'
10
10
 
11
11
  # Enqueues the execution of perform method into a worker.
12
12
  # @note Each worker needs to have a class #perform_async method that will allow us to pass
@@ -15,10 +15,20 @@ module Karafka
15
15
  # in the worker)
16
16
  def process
17
17
  Karafka.monitor.instrument('backends.sidekiq.process', caller: self) do
18
+ # We add batch metadata only for batch worker
19
+ batch_metadata_hash = if respond_to?(:batch_metadata)
20
+ # We remove deserializer as it's not safe to convert it to json
21
+ # and we can rebuild it anyhow based on the routing data in the
22
+ # worker
23
+ batch_metadata.to_h
24
+ .transform_keys(&:to_s)
25
+ .tap { |h| h.delete('deserializer') }
26
+ end
27
+
18
28
  topic.worker.perform_async(
19
29
  topic.id,
20
30
  topic.interchanger.encode(params_batch),
21
- respond_to?(:batch_metadata) ? batch_metadata.to_h : nil
31
+ batch_metadata_hash
22
32
  )
23
33
  end
24
34
  end
@@ -14,9 +14,19 @@ module Karafka
14
14
  # @return [Array<Hash>] Array with hash built out of params data
15
15
  def encode(params_batch)
16
16
  params_batch.map do |param|
17
+ metadata_hash = param.metadata.to_h
18
+ # All the metadata must have stringified keys in order to safe serialize
19
+ metadata_hash.transform_keys!(&:to_s)
20
+ # This will be taken back from the routing and is not safe for serialization
21
+ metadata_hash.delete('deserializer')
22
+
23
+ # Cast times to strings, we will de-serialize it back in Sidekiq
24
+ metadata_hash['receive_time'] = metadata_hash['receive_time'].to_f
25
+ metadata_hash['create_time'] = metadata_hash['create_time'].to_f
26
+
17
27
  {
18
28
  'raw_payload' => param.raw_payload,
19
- 'metadata' => param.metadata.to_h
29
+ 'metadata' => metadata_hash
20
30
  }
21
31
  end
22
32
  end
@@ -24,7 +34,16 @@ module Karafka
24
34
  # @param params_batch [Array<Hash>] Sidekiq params that are now an array
25
35
  # @return [Array<Hash>] exactly what we've fetched from Sidekiq
26
36
  def decode(params_batch)
27
- params_batch
37
+ params_batch.map do |param|
38
+ metadata = param['metadata']
39
+ # Covert serialized dates back to what they were
40
+ metadata['receive_time'] = Time.at(metadata['receive_time']).to_time
41
+ metadata['create_time'] = Time.at(metadata['create_time']).to_time
42
+
43
+ param['metadata'] = metadata
44
+
45
+ param
46
+ end
28
47
  end
29
48
  end
30
49
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-sidekiq-backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -34,7 +34,7 @@ cert_chain:
34
34
  R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
35
35
  pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-12-05 00:00:00.000000000 Z
37
+ date: 2022-04-17 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: karafka
@@ -105,6 +105,7 @@ licenses:
105
105
  - MIT
106
106
  metadata:
107
107
  source_code_uri: https://github.com/karafka/sidekiq-backend
108
+ rubygems_mfa_required: 'true'
108
109
  post_install_message:
109
110
  rdoc_options: []
110
111
  require_paths:
@@ -113,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
114
  requirements:
114
115
  - - ">="
115
116
  - !ruby/object:Gem::Version
116
- version: 2.6.0
117
+ version: '2.7'
117
118
  required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  requirements:
119
120
  - - ">="
120
121
  - !ruby/object:Gem::Version
121
122
  version: '0'
122
123
  requirements: []
123
- rubygems_version: 3.2.32
124
+ rubygems_version: 3.3.3
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: Karafka Sidekiq backend for background messages processing
metadata.gz.sig CHANGED
Binary file