karafka-core 2.0.3 → 2.0.4
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/FUNDING.yml +1 -0
- data/.github/workflows/ci.yml +3 -3
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +13 -13
- data/karafka-core.gemspec +5 -0
- data/lib/karafka/core/configurable/node.rb +4 -1
- data/lib/karafka/core/monitoring/notifications.rb +9 -3
- data/lib/karafka/core/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +8 -2
- 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: eb55ae933175f1fc17993fb6bb1e980a7a3494814ceb6ff0b88e3b5b069af2f5
|
4
|
+
data.tar.gz: af485691da69a93ad270db1d864aac83abe5f84de6e234a51888c7a6488503bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c6504961821ce9d3cc68d552a1b010a4c102a3d17570d6f950b541ebf48740df66a50b55ff2cfd1f086ebbf62f2bd0e7b3742a37ca1648c9acacfae0a439192
|
7
|
+
data.tar.gz: 641d243fbcf7ae79a34dcbfd1f1e66499d9bf3db4b8e6ec4a401844b0a4bc95e10a82fba45e2f94b39d082c29f17e9f786b1f6b4b4af1781ea01d5264ae949dc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
custom: ['https://karafka.io/#become-pro']
|
data/.github/workflows/ci.yml
CHANGED
@@ -23,7 +23,7 @@ jobs:
|
|
23
23
|
- ruby: '3.1'
|
24
24
|
coverage: 'true'
|
25
25
|
steps:
|
26
|
-
- uses: actions/checkout@
|
26
|
+
- uses: actions/checkout@v3
|
27
27
|
- name: Install package dependencies
|
28
28
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
29
29
|
- name: Set up Ruby
|
@@ -48,7 +48,7 @@ jobs:
|
|
48
48
|
strategy:
|
49
49
|
fail-fast: false
|
50
50
|
steps:
|
51
|
-
- uses: actions/checkout@
|
51
|
+
- uses: actions/checkout@v3
|
52
52
|
with:
|
53
53
|
fetch-depth: 0
|
54
54
|
- name: Set up Ruby
|
@@ -67,7 +67,7 @@ jobs:
|
|
67
67
|
strategy:
|
68
68
|
fail-fast: false
|
69
69
|
steps:
|
70
|
-
- uses: actions/checkout@
|
70
|
+
- uses: actions/checkout@v3
|
71
71
|
with:
|
72
72
|
fetch-depth: 0
|
73
73
|
- name: Run Coditsu
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Karafka core changelog
|
2
2
|
|
3
|
+
# 2.0.4 (2022-11-20)
|
4
|
+
- Disallow publishing events that were not registered.
|
5
|
+
- Fix a potential race condition when adding listeners concurrently from multiple threads.
|
6
|
+
|
3
7
|
## 2.0.3 (2022-10-13)
|
4
8
|
- Maintenance release. Cert chain update. No code changes.
|
5
9
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-core (2.0.
|
4
|
+
karafka-core (2.0.4)
|
5
5
|
concurrent-ruby (>= 1.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -21,19 +21,19 @@ GEM
|
|
21
21
|
i18n (1.12.0)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
23
|
minitest (5.16.3)
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
24
|
+
rspec (3.12.0)
|
25
|
+
rspec-core (~> 3.12.0)
|
26
|
+
rspec-expectations (~> 3.12.0)
|
27
|
+
rspec-mocks (~> 3.12.0)
|
28
|
+
rspec-core (3.12.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-expectations (3.12.0)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-mocks (3.12.0)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
35
|
+
rspec-support (~> 3.12.0)
|
36
|
+
rspec-support (3.12.0)
|
37
37
|
simplecov (0.21.2)
|
38
38
|
docile (~> 1.1)
|
39
39
|
simplecov-html (~> 0.11)
|
@@ -55,4 +55,4 @@ DEPENDENCIES
|
|
55
55
|
simplecov
|
56
56
|
|
57
57
|
BUNDLED WITH
|
58
|
-
2.3.
|
58
|
+
2.3.24
|
data/karafka-core.gemspec
CHANGED
@@ -28,7 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = %w[lib]
|
29
29
|
|
30
30
|
spec.metadata = {
|
31
|
+
'funding_uri' => 'https://karafka.io/#become-pro',
|
32
|
+
'homepage_uri' => 'https://karafka.io',
|
33
|
+
'changelog_uri' => 'https://github.com/karafka/karafka-core/blob/master/CHANGELOG.md',
|
34
|
+
'bug_tracker_uri' => 'https://github.com/karafka/karafka-core/issues',
|
31
35
|
'source_code_uri' => 'https://github.com/karafka/karafka-core',
|
36
|
+
'documentation_uri' => 'https://karafka.io/docs',
|
32
37
|
'rubygems_mfa_required' => 'true'
|
33
38
|
}
|
34
39
|
end
|
@@ -21,6 +21,7 @@ module Karafka
|
|
21
21
|
@name = name
|
22
22
|
@children = []
|
23
23
|
@nestings = nestings
|
24
|
+
@compiled = false
|
24
25
|
instance_eval(&nestings)
|
25
26
|
end
|
26
27
|
|
@@ -43,7 +44,7 @@ module Karafka
|
|
43
44
|
# Compile settings, allow for overrides via yielding
|
44
45
|
# @return [Node] returns self after configuration
|
45
46
|
def configure
|
46
|
-
compile
|
47
|
+
compile unless @compiled
|
47
48
|
yield(self) if block_given?
|
48
49
|
self
|
49
50
|
end
|
@@ -97,6 +98,8 @@ module Karafka
|
|
97
98
|
|
98
99
|
public_send("#{value.name}=", initialized)
|
99
100
|
end
|
101
|
+
|
102
|
+
@compiled = true
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
@@ -20,14 +20,17 @@ module Karafka
|
|
20
20
|
private_constant :EMPTY_HASH
|
21
21
|
|
22
22
|
def initialize
|
23
|
-
@listeners = Concurrent::Map.new
|
23
|
+
@listeners = Concurrent::Map.new do |k, v|
|
24
|
+
k.compute_if_absent(v) { Concurrent::Array.new }
|
25
|
+
end
|
26
|
+
|
24
27
|
# This allows us to optimize the method calling lookups
|
25
28
|
@events_methods_map = Concurrent::Map.new
|
26
29
|
end
|
27
30
|
|
28
31
|
# Registers a new event on which we can publish
|
29
32
|
#
|
30
|
-
# @param event_id [String
|
33
|
+
# @param event_id [String] event id
|
31
34
|
def register_event(event_id)
|
32
35
|
@listeners[event_id]
|
33
36
|
@events_methods_map[event_id] = :"on_#{event_id.to_s.tr('.', '_')}"
|
@@ -73,7 +76,7 @@ module Karafka
|
|
73
76
|
# Allows for code instrumentation
|
74
77
|
# Runs the provided code and sends the instrumentation details to all registered listeners
|
75
78
|
#
|
76
|
-
# @param event_id [String
|
79
|
+
# @param event_id [String] id of the event
|
77
80
|
# @param payload [Hash] payload for the instrumentation
|
78
81
|
# @param block [Proc] instrumented code
|
79
82
|
# @return [Object] whatever the provided block (if any) returns
|
@@ -83,6 +86,9 @@ module Karafka
|
|
83
86
|
# sleep(1)
|
84
87
|
# end
|
85
88
|
def instrument(event_id, payload = EMPTY_HASH, &block)
|
89
|
+
# Allow for instrumentation of only events we registered
|
90
|
+
raise EventNotRegistered, event_id unless @listeners.key?(event_id)
|
91
|
+
|
86
92
|
result, time = measure_time_taken(&block) if block_given?
|
87
93
|
|
88
94
|
event = Event.new(
|
data/lib/karafka/core/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
|
36
36
|
MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-11-20 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: concurrent-ruby
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- ".coditsu/ci.yml"
|
62
62
|
- ".console_irbrc"
|
63
63
|
- ".diffend.yml"
|
64
|
+
- ".github/FUNDING.yml"
|
64
65
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
65
66
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
66
67
|
- ".github/workflows/ci.yml"
|
@@ -97,7 +98,12 @@ homepage: https://karafka.io
|
|
97
98
|
licenses:
|
98
99
|
- MIT
|
99
100
|
metadata:
|
101
|
+
funding_uri: https://karafka.io/#become-pro
|
102
|
+
homepage_uri: https://karafka.io
|
103
|
+
changelog_uri: https://github.com/karafka/karafka-core/blob/master/CHANGELOG.md
|
104
|
+
bug_tracker_uri: https://github.com/karafka/karafka-core/issues
|
100
105
|
source_code_uri: https://github.com/karafka/karafka-core
|
106
|
+
documentation_uri: https://karafka.io/docs
|
101
107
|
rubygems_mfa_required: 'true'
|
102
108
|
post_install_message:
|
103
109
|
rdoc_options: []
|
metadata.gz.sig
CHANGED
Binary file
|