karafka 2.0.1 → 2.0.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: 5adfb5654381a04d5b7111806bd5bbba70f75f02e7044b57af09b91b547dbd09
4
- data.tar.gz: 9500da87035507a037218e9df5a11c8803e738c707b5d624c19559917939b689
3
+ metadata.gz: c2b67a18484b250b65788db213f615b7f1304ab33d6645bceeebdf8025b54bda
4
+ data.tar.gz: 27d4ece68701b9f34266ff834c9d0809690e06b108412f68916a39880a7a23f6
5
5
  SHA512:
6
- metadata.gz: 1acb20378ecdf95b87378297de714f6791f5abd3d411fbda4701231912e30033163c3b81a21f98a99d2ca247dbbe8cda72d81efc7b1d83a3aa019485dd2e8604
7
- data.tar.gz: 2a8d352d68852da005c87b0494457abf3559ec3975deb1098da233e16e4e33fed517020733300b2364ad650cc3764d59deb7fff6efe63e216e4fdb057c3e4ed8
6
+ metadata.gz: 682a0ff35d78e9eb5590bdb32bbc14bf47f18029003286d55d1f6f14425cd3d3ad6e8081a574f3f2146bc95d9ac692e9dc82622065e6dc6f092dc3dbe61652f3
7
+ data.tar.gz: 5a4e68ea639b9261172c055e6f22a741735262eb277acd18e465c862ead0242d0287b8872d6add290af0bba681f000a328f4c16d1ee31ca9075fe880552ddf9b
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.2 (2022-08-07)
4
+ - Bypass issue with Rails reload in development by releasing the connection (https://github.com/rails/rails/issues/44183).
5
+
3
6
  ## 2.0.1 (2022-08-06)
4
7
  - Provide `Karafka::Admin` for creation and destruction of topics and fetching cluster info.
5
8
  - Update integration specs to always use one-time disposable topics.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.0.1)
4
+ karafka (2.0.2)
5
5
  karafka-core (>= 2.0.2, < 3.0.0)
6
6
  rdkafka (>= 0.12)
7
7
  thor (>= 0.20)
data/lib/karafka/admin.rb CHANGED
@@ -8,7 +8,7 @@ module Karafka
8
8
  #
9
9
  # @note It always uses the primary defined cluster and does not support multi-cluster work.
10
10
  # If you need this, just replace the cluster info for the time you use this
11
- class Admin
11
+ module Admin
12
12
  class << self
13
13
  # Creates Kafka topic with given settings
14
14
  #
@@ -34,6 +34,7 @@ module Karafka
34
34
 
35
35
  worker.process
36
36
  worker.processed
37
+ worker.completed
37
38
 
38
39
  statistics.emitted
39
40
 
@@ -46,8 +46,9 @@ module Karafka
46
46
  def process
47
47
  job = @jobs_queue.pop
48
48
 
49
+ instrument_details = { caller: self, job: job, jobs_queue: @jobs_queue }
50
+
49
51
  if job
50
- instrument_details = { caller: self, job: job, jobs_queue: @jobs_queue }
51
52
 
52
53
  Karafka.monitor.instrument('worker.process', instrument_details)
53
54
 
@@ -82,6 +83,9 @@ module Karafka
82
83
  ensure
83
84
  # job can be nil when the queue is being closed
84
85
  @jobs_queue.complete(job) if job
86
+
87
+ # Always publish info, that we completed all the work despite its result
88
+ Karafka.monitor.instrument('worker.completed', instrument_details)
85
89
  end
86
90
  end
87
91
  end
@@ -77,6 +77,16 @@ if rails
77
77
 
78
78
  Rails.application.reloader.reload!
79
79
  end
80
+
81
+ ::Karafka::App.monitor.subscribe('worker.completed') do
82
+ # Skip in case someone is using Rails without ActiveRecord
83
+ next unless Object.const_defined?('ActiveRecord::Base')
84
+
85
+ # Always release the connection after processing is done. Otherwise thread may hang
86
+ # blocking the reload and further processing
87
+ # @see https://github.com/rails/rails/issues/44183
88
+ ActiveRecord::Base.connection_pool.release_connection
89
+ end
80
90
  end
81
91
 
82
92
  initializer 'karafka.require_karafka_boot_file' do |app|
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.1'
6
+ VERSION = '2.0.2'
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
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: 2022-08-06 00:00:00.000000000 Z
37
+ date: 2022-08-07 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: karafka-core
metadata.gz.sig CHANGED
Binary file