karafka-sidekiq-backend 1.4.2 → 1.4.5
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 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +55 -63
- data/README.md +15 -9
- data/certs/mensfeld.pem +21 -21
- data/karafka-sidekiq-backend.gemspec +3 -2
- data/lib/karafka/backends/sidekiq.rb +12 -2
- data/lib/karafka/extensions/sidekiq_topic_attributes.rb +2 -2
- data/lib/karafka/interchanger.rb +21 -2
- data.tar.gz.sig +1 -1
- metadata +28 -28
- metadata.gz.sig +0 -0
- data/.github/FUNDING.yml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcf2d7bdfcfb9f3a02a6c7346d9be92fe3df02494a320dd2ba86cb93ee8fe972
|
4
|
+
data.tar.gz: fca832af40b6a5f6dae9fb90de5e45ca403e1b6f2f6af8b2777058595a594a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5edc5af9d9be4021b4492e2375bde0bcff77c4afcd9b1f183d7edf220e5960932198b8b577a25e0c5b19434f827e1d01ee2a4316ada4ed072e96f942afc635b
|
7
|
+
data.tar.gz: 28778d43f235c71504dd46aea76346abef9104a27f0c3fc3911f8d878856278d73b8022a3d1ee65daa200e24eeeec2013aa33ac248234deb75e8e2bf675fe419
|
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,11 +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
22
|
include:
|
21
|
-
- ruby: '3.
|
23
|
+
- ruby: '3.1'
|
22
24
|
coverage: 'true'
|
23
25
|
steps:
|
24
26
|
- uses: actions/checkout@v2
|
@@ -50,7 +52,7 @@ jobs:
|
|
50
52
|
- name: Set up Ruby
|
51
53
|
uses: ruby/setup-ruby@v1
|
52
54
|
with:
|
53
|
-
ruby-version: 3.
|
55
|
+
ruby-version: 3.1
|
54
56
|
- name: Install latest bundler
|
55
57
|
run: gem install bundler --no-document
|
56
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.5 (2022-03-14)
|
4
|
+
- Fix Hash#except usage (barthez)
|
5
|
+
|
6
|
+
## 1.4.4 (2022-03-06)
|
7
|
+
- Ruby 3.1 support
|
8
|
+
- Drop support for Ruby 2.6
|
9
|
+
- Fix unsafe JSON serialization issued by Sidekiq (#122)
|
10
|
+
- Provide sub-second precision for data processed in Sidekiq
|
11
|
+
|
12
|
+
## 1.4.3 (2021-12-05)
|
13
|
+
- Source code metadata url added to the gemspec
|
14
|
+
|
3
15
|
## 1.4.2 (2021-04-21)
|
4
16
|
- Remove Ruby 2.5 support and update minimum Ruby requirement to 2.6
|
5
17
|
|
data/Gemfile.lock
CHANGED
@@ -1,46 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-sidekiq-backend (1.4.
|
4
|
+
karafka-sidekiq-backend (1.4.5)
|
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.9)
|
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.
|
17
|
-
digest-crc (0.6.
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
digest-crc (0.6.4)
|
18
18
|
rake (>= 12.0.0, < 14.0.0)
|
19
|
-
docile (1.
|
20
|
-
dry-configurable (0.
|
19
|
+
docile (1.4.0)
|
20
|
+
dry-configurable (0.14.0)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
dry-core (~> 0.
|
23
|
-
dry-container (0.
|
22
|
+
dry-core (~> 0.6)
|
23
|
+
dry-container (0.9.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
dry-configurable (~> 0.
|
26
|
-
dry-core (0.
|
25
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
26
|
+
dry-core (0.7.1)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
dry-equalizer (0.3.0)
|
29
28
|
dry-events (0.3.0)
|
30
29
|
concurrent-ruby (~> 1.0)
|
31
30
|
dry-core (~> 0.5, >= 0.5)
|
32
|
-
dry-inflector (0.2.
|
33
|
-
dry-initializer (3.
|
34
|
-
dry-logic (1.
|
31
|
+
dry-inflector (0.2.1)
|
32
|
+
dry-initializer (3.1.1)
|
33
|
+
dry-logic (1.2.0)
|
35
34
|
concurrent-ruby (~> 1.0)
|
36
35
|
dry-core (~> 0.5, >= 0.5)
|
37
|
-
dry-monitor (0.
|
38
|
-
dry-configurable (~> 0.
|
36
|
+
dry-monitor (0.5.0)
|
37
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
39
38
|
dry-core (~> 0.5, >= 0.5)
|
40
39
|
dry-events (~> 0.2)
|
41
|
-
dry-schema (1.
|
40
|
+
dry-schema (1.9.1)
|
42
41
|
concurrent-ruby (~> 1.0)
|
43
|
-
dry-configurable (~> 0.
|
42
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
44
43
|
dry-core (~> 0.5, >= 0.5)
|
45
44
|
dry-initializer (~> 3.0)
|
46
45
|
dry-logic (~> 1.0)
|
@@ -51,51 +50,44 @@ GEM
|
|
51
50
|
dry-core (~> 0.5, >= 0.5)
|
52
51
|
dry-inflector (~> 0.1, >= 0.1.2)
|
53
52
|
dry-logic (~> 1.0, >= 1.0.2)
|
54
|
-
dry-validation (1.
|
53
|
+
dry-validation (1.8.0)
|
55
54
|
concurrent-ruby (~> 1.0)
|
56
55
|
dry-container (~> 0.7, >= 0.7.1)
|
57
|
-
dry-core (~> 0.
|
58
|
-
dry-equalizer (~> 0.2)
|
56
|
+
dry-core (~> 0.5, >= 0.5)
|
59
57
|
dry-initializer (~> 3.0)
|
60
|
-
dry-schema (~> 1.
|
61
|
-
envlogic (1.1.
|
62
|
-
dry-inflector (~> 0.1)
|
63
|
-
io-console (0.5.9)
|
64
|
-
irb (1.3.5)
|
65
|
-
reline (>= 0.1.5)
|
66
|
-
karafka (1.4.4)
|
67
|
-
dry-configurable (~> 0.8)
|
58
|
+
dry-schema (~> 1.9, >= 1.9.1)
|
59
|
+
envlogic (1.1.4)
|
68
60
|
dry-inflector (~> 0.1)
|
69
|
-
|
70
|
-
dry-
|
61
|
+
karafka (1.4.13)
|
62
|
+
dry-configurable (~> 0.13)
|
63
|
+
dry-inflector (~> 0.2)
|
64
|
+
dry-monitor (~> 0.5)
|
65
|
+
dry-validation (~> 1.7)
|
71
66
|
envlogic (~> 1.1)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
zeitwerk (~> 2.1)
|
67
|
+
ruby-kafka (>= 1.3.0)
|
68
|
+
thor (>= 1.1)
|
69
|
+
waterdrop (~> 1.4)
|
70
|
+
zeitwerk (~> 2.4)
|
77
71
|
king_konf (1.0.0)
|
78
72
|
rack (2.2.3)
|
79
|
-
rake (13.0.
|
80
|
-
redis (4.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
rspec-
|
85
|
-
|
86
|
-
rspec-
|
87
|
-
rspec-
|
88
|
-
rspec-support (~> 3.10.0)
|
89
|
-
rspec-expectations (3.10.1)
|
73
|
+
rake (13.0.6)
|
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)
|
90
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
91
|
-
rspec-support (~> 3.
|
92
|
-
rspec-mocks (3.
|
83
|
+
rspec-support (~> 3.11.0)
|
84
|
+
rspec-mocks (3.11.0)
|
93
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
-
rspec-support (~> 3.
|
95
|
-
rspec-support (3.
|
96
|
-
ruby-kafka (1.
|
86
|
+
rspec-support (~> 3.11.0)
|
87
|
+
rspec-support (3.11.0)
|
88
|
+
ruby-kafka (1.4.0)
|
97
89
|
digest-crc
|
98
|
-
sidekiq (6.
|
90
|
+
sidekiq (6.4.1)
|
99
91
|
connection_pool (>= 2.2.2)
|
100
92
|
rack (~> 2.0)
|
101
93
|
redis (>= 4.2.0)
|
@@ -104,16 +96,16 @@ GEM
|
|
104
96
|
simplecov-html (~> 0.11)
|
105
97
|
simplecov_json_formatter (~> 0.1)
|
106
98
|
simplecov-html (0.12.3)
|
107
|
-
simplecov_json_formatter (0.1.
|
108
|
-
thor (1.1
|
109
|
-
waterdrop (1.4.
|
99
|
+
simplecov_json_formatter (0.1.4)
|
100
|
+
thor (1.2.1)
|
101
|
+
waterdrop (1.4.4)
|
110
102
|
delivery_boy (>= 0.2, < 2.x)
|
111
|
-
dry-configurable (~> 0.
|
112
|
-
dry-monitor (~> 0.
|
113
|
-
dry-validation (~> 1.
|
114
|
-
ruby-kafka (>=
|
115
|
-
zeitwerk (~> 2.
|
116
|
-
zeitwerk (2.4
|
103
|
+
dry-configurable (~> 0.13)
|
104
|
+
dry-monitor (~> 0.5)
|
105
|
+
dry-validation (~> 1.7)
|
106
|
+
ruby-kafka (>= 1.3.0)
|
107
|
+
zeitwerk (~> 2.4)
|
108
|
+
zeitwerk (2.5.4)
|
117
109
|
|
118
110
|
PLATFORMS
|
119
111
|
x86_64-linux
|
@@ -124,4 +116,4 @@ DEPENDENCIES
|
|
124
116
|
simplecov
|
125
117
|
|
126
118
|
BUNDLED WITH
|
127
|
-
2.
|
119
|
+
2.3.7
|
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Karafka Sidekiq Backend
|
2
2
|
|
3
|
+
## Deprecation notice
|
4
|
+
|
5
|
+
This backend was designed to compensate for lack of multi-threading in Karafka. After Karafka `2.0` release, this backend development won't be continued.
|
6
|
+
|
7
|
+
We will **still** support it for Karafka `1.4` but it won't work with Karafka `2.0`. We will however provide an extensive guide on how you can achieve similar functionality with Sidekiq yourself.
|
8
|
+
|
9
|
+
## About
|
10
|
+
|
3
11
|
[![Build Status](https://github.com/karafka/sidekiq-backend/workflows/ci/badge.svg)](https://github.com/karafka/sidekiq-backend/actions?query=workflow%3Aci)
|
4
12
|
[![Gem Version](https://badge.fury.io/rb/karafka-sidekiq-backend.svg)](http://badge.fury.io/rb/karafka-sidekiq-backend)
|
5
|
-
[![Join the chat at https://
|
13
|
+
[![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
|
6
14
|
|
7
15
|
[Karafka Sidekiq Backend](https://github.com/karafka/sidekiq-backend) provides support for consuming (processing) received Kafka messages inside of Sidekiq workers.
|
8
16
|
|
@@ -49,7 +57,7 @@ App.routes.draw do
|
|
49
57
|
backend :sidekiq
|
50
58
|
consumer Videos::DetailsConsumer
|
51
59
|
worker Workers::DetailsWorker
|
52
|
-
interchanger Interchangers::MyCustomInterchanger
|
60
|
+
interchanger Interchangers::MyCustomInterchanger.new
|
53
61
|
end
|
54
62
|
end
|
55
63
|
end
|
@@ -64,7 +72,7 @@ There are two options you can set inside of the ```topic``` block:
|
|
64
72
|
| Option | Value type | Description |
|
65
73
|
|--------------|------------|-------------------------------------------------------------------------------------------------------------------|
|
66
74
|
| worker | Class | Name of a worker class that we want to use to schedule perform code |
|
67
|
-
| interchanger |
|
75
|
+
| interchanger | Instance | Instance of an interchanger class that we want to use to pass the incoming data to Sidekiq |
|
68
76
|
|
69
77
|
|
70
78
|
### Workers
|
@@ -102,7 +110,7 @@ App.routes.draw do
|
|
102
110
|
consumer_group :videos_consumer do
|
103
111
|
topic :binary_video_details do
|
104
112
|
consumer Videos::DetailsConsumer
|
105
|
-
interchanger Interchangers::MyCustomInterchanger
|
113
|
+
interchanger Interchangers::MyCustomInterchanger.new
|
106
114
|
end
|
107
115
|
end
|
108
116
|
end
|
@@ -132,10 +140,8 @@ end
|
|
132
140
|
|
133
141
|
## Note on contributions
|
134
142
|
|
135
|
-
First, thank you for considering contributing to Karafka! It's people like you that make the open source community such a great community!
|
136
|
-
|
137
|
-
Each pull request must pass all the RSpec specs and meet our quality requirements.
|
143
|
+
First, thank you for considering contributing to the Karafka ecosystem! It's people like you that make the open source community such a great community!
|
138
144
|
|
139
|
-
|
145
|
+
Each pull request must pass all the RSpec specs, integration tests and meet our quality requirements.
|
140
146
|
|
141
|
-
|
147
|
+
Fork it, update and wait for the Github Actions results.
|
data/certs/mensfeld.pem
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
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0/UuTTFgW+CGk2U0RDw2RBOca
|
17
|
+
W2LTF/G7AOzuzD0Tc4voc7WXyrgKwJREv8rgBimLnNlgmFJLmtUCh2U/MgxvcilH
|
18
|
+
yshYcbseNvjkrtYnLRlWZR4SSB6Zei5AlyGVQLPkvdsBpNegcG6w075YEwzX/38a
|
19
|
+
8V9B/Yri2OGELBz8ykl7BsXUgNoUPA/4pHF6YRLz+VirOaUIQ4JfY7xGj6fSOWWz
|
20
|
+
/rQ/d77r6o1mfJYM/3BRVg73a3b7DmRnE5qjwmSaSQ7u802pJnLesmArch0xGCT/
|
21
|
+
fMmRli1Qb+6qOTl9mzD6UDMAyFR4t6MStLm0mIEqM0nBO5nUdUWbC7l9qXEf8XBE
|
22
|
+
2DP28p3EqSuS+lKbAWKcqv7t0iRhhmaod+Yn9mcrLN1sa3q3KSQ9BCyxezCD4Mk2
|
23
|
+
R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
|
24
|
+
pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
|
25
25
|
-----END CERTIFICATE-----
|
@@ -10,14 +10,14 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.platform = Gem::Platform::RUBY
|
11
11
|
spec.authors = ['Maciej Mensfeld']
|
12
12
|
spec.email = %w[maciej@mensfeld.pl]
|
13
|
-
spec.homepage = 'https://
|
13
|
+
spec.homepage = 'https://karafka.io'
|
14
14
|
spec.summary = 'Karafka Sidekiq backend for background messages processing'
|
15
15
|
spec.description = 'Karafka Sidekiq backend for background messages processing'
|
16
16
|
spec.license = 'MIT'
|
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,4 +27,5 @@ 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
|
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.5'
|
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
|
@@ -11,8 +11,8 @@ module Karafka
|
|
11
11
|
@worker ||= backend == :sidekiq ? Karafka::Workers::Builder.new(consumer).build : nil
|
12
12
|
end
|
13
13
|
|
14
|
-
# @return [
|
15
|
-
# params between Karafka server and Karafka background job
|
14
|
+
# @return [#encode, #decode] Interchanger instance (not a class) that we want to use to
|
15
|
+
# interchange params between Karafka server and Karafka background job
|
16
16
|
def interchanger
|
17
17
|
@interchanger ||= Karafka::Interchanger.new
|
18
18
|
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
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��IQ�I6R���&�G�|�M� b�K�3e!�u�Y�����-��+4�Z,&�S��x������܄'�W$H-��b�����8)h�[�l
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -11,30 +11,30 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjEwODExMTQxNTEzWhcNMjIwODExMTQx
|
15
|
+
NTEzWjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
16
|
+
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDV2jKH4Ti87GM6nyT6D+ESzTI0MZDj
|
17
|
+
ak2/TEwnxvijMJyCCPKT/qIkbW4/f0VHM4rhPr1nW73sb5SZBVFCLlJcOSKOBdUY
|
18
|
+
TMY+SIXN2EtUaZuhAOe8LxtxjHTgRHvHcqUQMBENXTISNzCo32LnUxweu66ia4Pd
|
19
|
+
1mNRhzOqNv9YiBZvtBf7IMQ+sYdOCjboq2dlsWmJiwiDpY9lQBTnWORnT3mQxU5x
|
20
|
+
vPSwnLB854cHdCS8fQo4DjeJBRZHhEbcE5sqhEMB3RZA3EtFVEXOxlNxVTS3tncI
|
21
|
+
qyNXiWDaxcipaens4ObSY1C2HTV7OWb7OMqSCIybeYTSfkaSdqmcl4S6zxXkjH1J
|
22
|
+
tnjayAVzD+QVXGijsPLE2P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
|
37
|
-
date:
|
37
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: karafka
|
@@ -73,7 +73,6 @@ extra_rdoc_files: []
|
|
73
73
|
files:
|
74
74
|
- ".coditsu/ci.yml"
|
75
75
|
- ".diffend.yml"
|
76
|
-
- ".github/FUNDING.yml"
|
77
76
|
- ".github/workflows/ci.yml"
|
78
77
|
- ".gitignore"
|
79
78
|
- ".rspec"
|
@@ -101,10 +100,11 @@ files:
|
|
101
100
|
- lib/karafka/interchanger.rb
|
102
101
|
- lib/karafka/workers/builder.rb
|
103
102
|
- lib/karafka_sidekiq_backend.rb
|
104
|
-
homepage: https://
|
103
|
+
homepage: https://karafka.io
|
105
104
|
licenses:
|
106
105
|
- MIT
|
107
|
-
metadata:
|
106
|
+
metadata:
|
107
|
+
source_code_uri: https://github.com/karafka/sidekiq-backend
|
108
108
|
post_install_message:
|
109
109
|
rdoc_options: []
|
110
110
|
require_paths:
|
@@ -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.
|
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.
|
123
|
+
rubygems_version: 3.3.4
|
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
|
data/.github/FUNDING.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
open_collective: karafka
|