lib/fluent/plugin/in_mqtt.rb in fluent-plugin-mqtt-io-0.4.0 vs lib/fluent/plugin/in_mqtt.rb in fluent-plugin-mqtt-io-0.4.1
- old
+ new
@@ -64,16 +64,23 @@
def current_plugin_name
:in_mqtt
end
+ def kill_thread
+ @get_thread.kill if !@get_thread.nil?
+ end
+
def after_disconnection
+ kill_thread
+ super
end
def after_connection
if @client.connected?
@client.subscribe(@topic)
- @get_thread = thread_create(:in_mqtt_get) do
+ #@get_thread = thread_create(:in_mqtt_get) do
+ @get_thread = Thread.new do
@client.get do |topic, message|
emit(topic, message)
end
end
end