Skip to content

Commit 2d26a53

Browse files
committed
Ensure threads are running when calling deliver_messages
Currently if the worker thread has died unexpectedly and we subsequently call `deliver_messages`, the messages won't actually get delivered until another message is produced. With this change we will restart the worker thread so it can receive the `deliver_messages` message.
1 parent 2205415 commit 2d26a53

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/kafka/async_producer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def produce(value, topic:, **options)
131131
# @see Kafka::Producer#deliver_messages
132132
# @return [nil]
133133
def deliver_messages
134+
ensure_threads_running!
135+
134136
@queue << [:deliver_messages, nil]
135137

136138
nil

0 commit comments

Comments
 (0)