Navigation Menu

Skip to content

Commit

Permalink
Reduce needless signals
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 11, 2014
1 parent cee2e51 commit a9ae0ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/droonga/fluent_message_sender.rb
Expand Up @@ -55,7 +55,10 @@ def send(tag, data)
packed_fluent_message = MessagePackPacker.pack(fluent_message)
@write_mutex.synchronize do
@buffer << packed_fluent_message
@writer.signal
unless @signaling
@signaling = true
@writer.signal
end
end
logger.trace("send: done")
end
Expand Down Expand Up @@ -107,9 +110,11 @@ def shutdown_socket

def start_writer
@writer = Coolio::AsyncWatcher.new
@signaling = false

on_signal = lambda do
@write_mutex.synchronize do
@signaling = false
connect unless connected?
@buffer.each do |data|
@socket.write(data)
Expand Down

0 comments on commit a9ae0ab

Please sign in to comment.