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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +5 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +27 -33
- data/karafka-sidekiq-backend.gemspec +6 -2
- data/lib/karafka/backends/sidekiq.rb +12 -2
- data/lib/karafka/interchanger.rb +21 -2
- data.tar.gz.sig +0 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cb88351e03ddacb161235d09b97c5af053c32534a52655c916c8a2b01da4ed6
|
4
|
+
data.tar.gz: 4549af8841e8921cc65745c5c6ebd5d9a8cd1ace26735c83b24882b51db62b07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f13198ce14db272f25922d82d135b6964eb23a0c3baeb873f846b25419f0816544ae5cbad1829bb4fa15956a5cbced7032193c5172ce3149f729ef48a4344e69
|
7
|
+
data.tar.gz: 57d62c62b5e24d3ffa5476d95094d4a93e9701aba7953d2a09e43a5a6f4d1901c54eb0e69c53f8e0df8e944eafe61dbcd285b913eff24af0d594ac84ed940351
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -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.
|
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.
|
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
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
58
|
+
dry-schema (~> 1.9, >= 1.9.1)
|
59
59
|
envlogic (1.1.4)
|
60
60
|
dry-inflector (~> 0.1)
|
61
|
-
|
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.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
rspec-
|
83
|
-
|
84
|
-
rspec-
|
85
|
-
rspec-
|
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.
|
90
|
-
rspec-mocks (3.
|
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.
|
93
|
-
rspec-support (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.
|
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.
|
106
|
-
thor (1.1
|
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.
|
108
|
+
zeitwerk (2.5.4)
|
115
109
|
|
116
110
|
PLATFORMS
|
117
|
-
|
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.
|
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.
|
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
|
-
|
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.
|
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
|
-
|
31
|
+
batch_metadata_hash
|
22
32
|
)
|
23
33
|
end
|
24
34
|
end
|
data/lib/karafka/interchanger.rb
CHANGED
@@ -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' =>
|
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.
|
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:
|
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.
|
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.
|
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
|