karafka-core 2.5.2 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcd7aa040c5e5025430de4755c6e3de2850f8e697a8222328a304f571d9bd1fc
4
- data.tar.gz: b3498c28bf38256e7012a950a51f464d66a503c045227f1dde0e503b6d9550c3
3
+ metadata.gz: 8893405950939cce7d2c5f908984363927426b166cfe3afbd3a4ace9895acbe7
4
+ data.tar.gz: 19db627e288c6ae32af18be68691ca9cf4754447a6e4ee3f3a47ac8f8025ffb1
5
5
  SHA512:
6
- metadata.gz: 350399becfcf8a702a9c106cb6f6310dc57255549fbe54cd7bbadae4e1c2c1e13efc53b9d60972c20c2a057775483461f73f60dc2839da964db39de47b7f608d
7
- data.tar.gz: 4b94de1f08121280d3321dad105487e7b3e3ddaefe2ba2d4a3dd67a5c2fe3b23cb5588fa707d8ad513346c860749f9389431751b26c1688b19104a585bda4de6
6
+ metadata.gz: 5c680542fb2a726ec1339a2c157d6579a3bb76fac4204676721fc2ed75f52ef6ef1bd3c2ab03983e066603014d74e804a2e737656dfba55ad9858ae57cceda57
7
+ data.tar.gz: 4f27f566b94e246ff989edf08680574a336f3a9a85d46008d22c3de8abfbd7a7adac87158f51639d50a03efb502232bc20fc3ba29d081db596688b635985dac8
@@ -24,6 +24,7 @@ jobs:
24
24
  fail-fast: false
25
25
  matrix:
26
26
  ruby:
27
+ - '3.5.0-preview1'
27
28
  - '3.4'
28
29
  - '3.3'
29
30
  - '3.2'
@@ -40,7 +41,7 @@ jobs:
40
41
  run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
41
42
 
42
43
  - name: Set up Ruby
43
- uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
44
+ uses: ruby/setup-ruby@bb6434c747fa7022e12fa1cae2a0951fcffcff26 # v1.253.0
44
45
  with:
45
46
  ruby-version: ${{matrix.ruby}}
46
47
  bundler: 'latest'
@@ -71,7 +72,7 @@ jobs:
71
72
  with:
72
73
  fetch-depth: 0
73
74
  - name: Set up Ruby
74
- uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
75
+ uses: ruby/setup-ruby@bb6434c747fa7022e12fa1cae2a0951fcffcff26 # v1.253.0
75
76
  with:
76
77
  ruby-version: 3.4
77
78
  - name: Install latest bundler
@@ -24,7 +24,7 @@ jobs:
24
24
  fetch-depth: 0
25
25
 
26
26
  - name: Set up Ruby
27
- uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
27
+ uses: ruby/setup-ruby@bb6434c747fa7022e12fa1cae2a0951fcffcff26 # v1.253.0
28
28
  with:
29
29
  bundler-cache: false
30
30
 
@@ -0,0 +1,30 @@
1
+ name: Trigger Wiki Refresh
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ push:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ trigger-wiki-refresh:
11
+ runs-on: ubuntu-latest
12
+ environment: wiki-trigger
13
+ if: github.repository_owner == 'karafka'
14
+ steps:
15
+ - name: Trigger wiki refresh
16
+ uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
17
+ with:
18
+ token: ${{ secrets.WIKI_REPO_TOKEN }}
19
+ repository: karafka/wiki
20
+ event-type: sync-trigger
21
+ client-payload: |
22
+ {
23
+ "repository": "${{ github.repository }}",
24
+ "event_name": "${{ github.event_name }}",
25
+ "release_tag": "${{ github.event.release.tag_name || '' }}",
26
+ "release_name": "${{ github.event.release.name || '' }}",
27
+ "commit_sha": "${{ github.sha }}",
28
+ "commit_message": "Trigger Wiki Refresh",
29
+ "triggered_by": "${{ github.actor }}"
30
+ }
@@ -4,7 +4,7 @@ on:
4
4
  paths:
5
5
  - '.github/workflows/**'
6
6
  jobs:
7
- verify:
7
+ verify_action_pins:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.4
1
+ 3.4.5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Karafka Core Changelog
2
2
 
3
+ ## 2.5.3 (2025-08-04)
4
+ - [Enhancement] Optimize code to mitigate the Ruby performance warning from `Karafka::Core::Configurable::Node` (#208)
5
+ - [Enhancement] Raise errors on detected Ruby warnings.
6
+ - [Change] Remove unused Ruby 2.7 code.
7
+ - [Change] Remove `funding_uri` from the gemspec to minimize double-funding info.
8
+
3
9
  ## 2.5.2 (2025-06-11)
4
10
  - [Enhancement] Support `#unsubscribe`.
5
11
  - [Enhancement] Allow for providing a root scope path for error keys.
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ group :test do
10
10
  gem 'byebug'
11
11
  gem 'rspec'
12
12
  gem 'simplecov'
13
+ gem 'warning'
13
14
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.5.2)
4
+ karafka-core (2.5.3)
5
5
  karafka-rdkafka (>= 0.19.2, < 0.21.0)
6
6
  logger (>= 1.6.0)
7
7
 
@@ -48,6 +48,7 @@ GEM
48
48
  simplecov_json_formatter (~> 0.1)
49
49
  simplecov-html (0.13.1)
50
50
  simplecov_json_formatter (0.1.4)
51
+ warning (1.5.0)
51
52
 
52
53
  PLATFORMS
53
54
  aarch64-linux-gnu
@@ -67,6 +68,7 @@ DEPENDENCIES
67
68
  karafka-core!
68
69
  rspec
69
70
  simplecov
71
+ warning
70
72
 
71
73
  BUNDLED WITH
72
74
  2.6.9
data/karafka-core.gemspec CHANGED
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = %w[lib]
26
26
 
27
27
  spec.metadata = {
28
- 'funding_uri' => 'https://karafka.io/#become-pro',
29
28
  'homepage_uri' => 'https://karafka.io',
30
29
  'changelog_uri' => 'https://karafka.io/docs/Changelog-Karafka-Core',
31
30
  'bug_tracker_uri' => 'https://github.com/karafka/karafka-core/issues',
@@ -22,6 +22,7 @@ module Karafka
22
22
  @children = []
23
23
  @nestings = nestings
24
24
  @compiled = false
25
+ @configs_refs = {}
25
26
  instance_eval(&nestings)
26
27
  end
27
28
 
@@ -58,7 +59,14 @@ module Karafka
58
59
 
59
60
  @children.each do |value|
60
61
  config[value.node_name] = if value.is_a?(Leaf)
61
- result = public_send(value.node_name)
62
+ result = if @configs_refs.key?(value.node_name)
63
+ @configs_refs[value.node_name]
64
+ elsif value.constructor
65
+ value.constructor.call
66
+ elsif value.default
67
+ value.default
68
+ end
69
+
62
70
  # We need to check if value is not a result node for cases
63
71
  # where we merge additional config
64
72
  result.is_a?(Node) ? result.to_h : result
@@ -96,12 +104,12 @@ module Karafka
96
104
  @children.each do |value|
97
105
  # Do not redefine something that was already set during compilation
98
106
  # This will allow us to reconfigure things and skip override with defaults
99
- skippable = respond_to?(value.node_name) || (value.is_a?(Leaf) && value.compiled?)
107
+ skippable = @configs_refs.key?(value.node_name) || (value.is_a?(Leaf) && value.compiled?)
100
108
  lazy_leaf = value.is_a?(Leaf) && value.lazy?
101
109
 
102
110
  # Do not create accessor for leafs that are lazy as they will get a custom method
103
111
  # created instead
104
- singleton_class.attr_accessor(value.node_name) unless lazy_leaf
112
+ build_accessors(value) unless lazy_leaf
105
113
 
106
114
  next if skippable
107
115
 
@@ -123,7 +131,7 @@ module Karafka
123
131
  if lazy_leaf && !initialized
124
132
  build_dynamic_accessor(value)
125
133
  else
126
- public_send("#{value.node_name}=", initialized)
134
+ @configs_refs[value.node_name] = initialized
127
135
  end
128
136
  end
129
137
 
@@ -139,16 +147,18 @@ module Karafka
139
147
  #
140
148
  # @param value [Leaf]
141
149
  def build_dynamic_accessor(value)
142
- singleton_class.attr_writer(value.node_name)
143
-
144
150
  define_singleton_method(value.node_name) do
145
- existing = instance_variable_get("@#{value.node_name}")
151
+ existing = @configs_refs.fetch(value.node_name, false)
146
152
 
147
- return existing if existing
153
+ return existing unless existing == false
148
154
 
149
155
  built = call_constructor(value)
150
156
 
151
- instance_variable_set("@#{value.node_name}", built)
157
+ @configs_refs[value.node_name] = built
158
+ end
159
+
160
+ define_singleton_method(:"#{value.node_name}=") do |new_value|
161
+ @configs_refs[value.node_name] = new_value
152
162
  end
153
163
  end
154
164
 
@@ -165,6 +175,23 @@ module Karafka
165
175
  constructor.call(value.default)
166
176
  end
167
177
  end
178
+
179
+ # Builds regular accessors for value fetching
180
+ #
181
+ # @param value [Leaf]
182
+ def build_accessors(value)
183
+ unless respond_to?(value.node_name.to_sym)
184
+ define_singleton_method(value.node_name) do
185
+ @configs_refs[value.node_name]
186
+ end
187
+ end
188
+
189
+ return if respond_to?(:"#{value.node_name}=")
190
+
191
+ define_singleton_method(:"#{value.node_name}=") do |new_value|
192
+ @configs_refs[value.node_name] = new_value
193
+ end
194
+ end
168
195
  end
169
196
  end
170
197
  end
@@ -63,23 +63,9 @@ module Karafka
63
63
  config.configure(&block)
64
64
  end
65
65
 
66
- # Two versions are needed to pass arguments in the correct way
67
- if RUBY_VERSION >= '2.7'
68
- class_eval <<~CODE, __FILE__, __LINE__ + 1
69
- # Pipes the settings setup to the config root node
70
- def setting(...)
71
- config.setting(...)
72
- end
73
- CODE
74
- else
75
- class_eval <<~CODE, __FILE__, __LINE__ + 1
76
- # Pipes the settings setup to the config root node
77
- # @param args [Object] anything provided to settings
78
- # @param block [Proc] block for settings
79
- def setting(*args, &block)
80
- config.setting(*args, &block)
81
- end
82
- CODE
66
+ # Pipes the settings setup to the config root node
67
+ def setting(...)
68
+ config.setting(...)
83
69
  end
84
70
  end
85
71
  end
@@ -4,6 +4,6 @@ module Karafka
4
4
  module Core
5
5
  # Current Karafka::Core version
6
6
  # We follow the versioning schema of given Karafka version
7
- VERSION = '2.5.2'
7
+ VERSION = '2.5.3'
8
8
  end
9
9
  end
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.5.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -59,6 +59,7 @@ files:
59
59
  - ".github/ISSUE_TEMPLATE/feature_request.md"
60
60
  - ".github/workflows/ci.yml"
61
61
  - ".github/workflows/push.yml"
62
+ - ".github/workflows/trigger-wiki-refresh.yml"
62
63
  - ".github/workflows/verify-action-pins.yml"
63
64
  - ".gitignore"
64
65
  - ".rspec"
@@ -101,7 +102,6 @@ homepage: https://karafka.io
101
102
  licenses:
102
103
  - MIT
103
104
  metadata:
104
- funding_uri: https://karafka.io/#become-pro
105
105
  homepage_uri: https://karafka.io
106
106
  changelog_uri: https://karafka.io/docs/Changelog-Karafka-Core
107
107
  bug_tracker_uri: https://github.com/karafka/karafka-core/issues
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.6.7
125
+ rubygems_version: 3.6.9
126
126
  specification_version: 4
127
127
  summary: Karafka ecosystem core modules
128
128
  test_files: []