Add check whether buffer is empty
This commit is contained in:
@ -112,7 +112,7 @@ class Runner::Connection
|
|||||||
|
|
||||||
def on_close(_event)
|
def on_close(_event)
|
||||||
Rails.logger.debug { "#{Time.zone.now.getutc}: Closing connection to #{@socket.url} with status: #{@status}" }
|
Rails.logger.debug { "#{Time.zone.now.getutc}: Closing connection to #{@socket.url} with status: #{@status}" }
|
||||||
forward_message @buffer.flush
|
forward_message @buffer.flush unless @buffer.empty?
|
||||||
|
|
||||||
# Depending on the status, we might want to destroy the runner at management.
|
# Depending on the status, we might want to destroy the runner at management.
|
||||||
# This ensures we get a new runner on the next request.
|
# This ensures we get a new runner on the next request.
|
||||||
|
@ -38,6 +38,10 @@ class Runner::Connection::Buffer
|
|||||||
remaining_buffer
|
remaining_buffer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def empty?
|
||||||
|
@line_buffer.empty? && @global_buffer.empty?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def process_and_split(message_parts, stop: false)
|
def process_and_split(message_parts, stop: false)
|
||||||
|
Reference in New Issue
Block a user