skroutz / rafka

Kafka proxy with a simple API, speaking the Redis protocol
https://engineering.skroutz.gr/blog/kafka-rails-integration/
GNU General Public License v3.0
8 stars 0 forks source link

producer: Outstanding events even if message if flushed #33

Closed agis closed 7 years ago

agis commented 7 years ago

The following script produces exactly 1 message:

# test.rb
require 'rafka'

p = Rafka::Producer.new
p.produce("test-rafka2", "foo#{Time.now}")

We run it as follows:

$ ruby test.rb

Since producing is an asynchronous operation, the script exits immediately. In the meanwhile, a consumer is running on the topic and consumes the message, but Rafka reports the following:

# ...
[producer-13] 2017/08/24 13:06:52 Started working...
# ... script has exited by now
# ... 5 secs. pass
[producer-13] 2017/08/24 13:06:57 Flush timeout: 1 unflushed events
[producer-13] 2017/08/24 13:06:57 Bye

This is a bug: there shouldn't be any outstanding events in the queue since the message was actually processed by the consumer.