karafka-sidekiq-backend 1.4.3 → 1.4.4

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: 4c4560c74ccb09e782379a950507c3989adef5c3be5415beeeb2003b9d641768
4
+ data.tar.gz: 22422624c731faa13641adf08a36cd067913826358a57a38e45f8a5a5be553af
5
5
  SHA512:
6
- metadata.gz: 8fe7c353bce5b28ab7abf84136d7a0550387627a036c4a9f90e8bd567441931c765f48781f282cc74a0f47f23df91c80b605f614bcfab917ccd2c002a8471cfa
7
- data.tar.gz: 1d7764a08a7c407457762acb6c84110c5ef43cd3f630d7d89d284629cb76d2bf0bfef98bf3587020c3ce640b85428b27830bb86737569a29cf946d4211b848b9
6
+ metadata.gz: 0ec03fbc6ece2e0664e61d44de00b30f3e0690cb0d3bc8e15eceb9af73b33272264927b8fccb025c742911fa4b506360a5bb7d1536e85f9ed2421a9ba78405ce
7
+ data.tar.gz: 5222810dc912bde65da7db269e07d3556a850e471b3b02217fba07764590e6673e3f975bbe7e697f2204668d24cc518ff97eae20b7d684803208b35a4017a8bb
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,11 @@
1
1
  # Karafka Sidekiq Backend
2
2
 
3
+ ## 1.4.4 (2022-03-06)
4
+ - Ruby 3.1 support
5
+ - Drop support for Ruby 2.6
6
+ - Fix unsafe JSON serialization issued by Sidekiq (#122)
7
+ - Provide sub-second precision for data processed in Sidekiq
8
+
3
9
  ## 1.4.3 (2021-12-05)
4
10
  - Source code metadata url added to the gemspec
5
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-sidekiq-backend (1.4.3)
4
+ karafka-sidekiq-backend (1.4.4)
5
5
  karafka (~> 1.4.0)
6
6
  sidekiq (>= 4.2)
7
7
 
@@ -13,11 +13,11 @@ GEM
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.0)
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,9 @@ 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
118
111
  x86_64-linux
119
112
 
120
113
  DEPENDENCIES
@@ -123,4 +116,4 @@ DEPENDENCIES
123
116
  simplecov
124
117
 
125
118
  BUNDLED WITH
126
- 2.2.32
119
+ 2.3.7
@@ -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')
@@ -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.4'
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,18 @@ 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.transform_keys(&:to_s).except('deserializer')
24
+ end
25
+
18
26
  topic.worker.perform_async(
19
27
  topic.id,
20
28
  topic.interchanger.encode(params_batch),
21
- respond_to?(:batch_metadata) ? batch_metadata.to_h : nil
29
+ batch_metadata_hash
22
30
  )
23
31
  end
24
32
  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.4
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-03-06 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: karafka
@@ -113,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: 2.6.0
116
+ version: '2.7'
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.2.32
123
+ rubygems_version: 3.3.3
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Karafka Sidekiq backend for background messages processing
metadata.gz.sig CHANGED
Binary file