karafka-core 2.2.1 → 2.2.2

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: c2f5012295cee5675f7217bb18edc47755020845d882457151ce6e7cd92cff51
4
- data.tar.gz: 18f2697a2e4a85ed328f8fac9b029d0085ca5d699fc74c154eaf83f8df326d6c
3
+ metadata.gz: 267d7bea7b3b01122363dfe4d2157f9e400b89b375a8f21c61e913dfb54b89e6
4
+ data.tar.gz: f5b5b6d2b0e253aa3df2444fbd02aebae91b232e66b836f895128173eab481af
5
5
  SHA512:
6
- metadata.gz: a5c61fece07c11cb61f46319a39530870f501991d781df5ac8697775d032ed6f6bc890a47e20709dd53086a758a6d4a8b404a6871b8b62dbbb8503b735c8b3a8
7
- data.tar.gz: 9b602af1b041ac9b879a8df26ceb84b548aeb79f803dd9c59eff9e10762b6b6001ae29b1cba1ea4b7b63703f6a8bd65bc036109c611668401f59762102127a77
6
+ metadata.gz: 2d5a57339a3259cd1561af52e33eb31b592d8e7b59201d3394a8f58f75ddd5c8acd835b94a8c9d50a93f48137191a5bb9d0570002234f2593652ed16b76a9b81
7
+ data.tar.gz: 3d00d4800f4c9ac425fd3f951b7bdee94a407a23d009c921f2c64799f32e36ea936814235dec0df922941036361c500e65fcda210aaf983c38ec9f3bf00c09e5
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Karafka core changelog
2
2
 
3
+ ### 2.2.2 (2023-09-11)
4
+ - [Fix] Reuse previous frozen duration as a base for incoming computation.
5
+
3
6
  ## 2.2.1 (2023-09-10)
4
7
  - Optimize statistics decorator by minimizing number of new objects created.
5
8
  - Expand the decoration to include new value `_fd` providing freeze duration in milliseconds. This value informs us for how many consecutive ms the given value did not change. It can be useful for detecting values that should change once in a while but are stale.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.2.1)
4
+ karafka-core (2.2.2)
5
5
  concurrent-ruby (>= 1.1)
6
6
  karafka-rdkafka (>= 0.13.1, < 0.14.0)
7
7
 
@@ -61,13 +61,17 @@ module Karafka
61
61
  # @return [Object] the diff if the values were numerics or the current scope
62
62
  def diff(previous, current)
63
63
  if current.is_a?(Hash)
64
+ filled_previous = previous || EMPTY_HASH
65
+ filled_current = current || EMPTY_HASH
66
+
64
67
  # @note We cannot use #each_key as we modify the content of the current scope
65
68
  # in place (in case it's a hash)
66
69
  current.keys.each do |key|
67
70
  append(
68
- current,
71
+ filled_previous,
72
+ filled_current,
69
73
  key,
70
- diff((previous || EMPTY_HASH)[key], (current || EMPTY_HASH)[key])
74
+ diff(filled_previous[key], filled_current[key])
71
75
  )
72
76
  end
73
77
  end
@@ -84,17 +88,18 @@ module Karafka
84
88
 
85
89
  # Appends the result of the diff to a given key as long as the result is numeric
86
90
  #
91
+ # @param previous [Hash] previous scope
87
92
  # @param current [Hash] current scope
88
93
  # @param key [Symbol] key based on which we were diffing
89
94
  # @param result [Object] diff result
90
- def append(current, key, result)
95
+ def append(previous, current, key, result)
91
96
  return unless result.is_a?(Numeric)
92
97
  return if current.frozen?
93
98
 
94
99
  freeze_duration_key = "#{key}_fd"
95
100
 
96
101
  if result.zero?
97
- current[freeze_duration_key] ||= 0
102
+ current[freeze_duration_key] = previous[freeze_duration_key] || 0
98
103
  current[freeze_duration_key] += @change_d
99
104
  else
100
105
  current[freeze_duration_key] = 0
@@ -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.2.1'
7
+ VERSION = '2.2.2'
8
8
  end
9
9
  end
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.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
36
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
37
  -----END CERTIFICATE-----
38
- date: 2023-09-10 00:00:00.000000000 Z
38
+ date: 2023-09-11 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: concurrent-ruby
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.4.10
151
+ rubygems_version: 3.4.19
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Karafka ecosystem core modules
metadata.gz.sig CHANGED
Binary file