lib/logstash/outputs/bigquery/batcher.rb
# enqueue adds a message to the batch. If the batch is ready to be sent
# out the internal state is reset and the array of messages is both
# yielded and returned.
# Otherwise nil is returned.
enqueue adds a message to the batch. If the batch is ready to be sent
out the internal state is reset and the array of messages is both
yielded and returned.
Otherwise nil is returned.
enqueue adds a message to the batch . If the batch is ready to be sent out the internal state is reset and the array of messages is both yielded and returned . Otherwise nil is returned .
def enqueue(message)
          @lock.write_lock.lock
          orig = nil
          begin
            is_flush_request = message.nil?
            unless is_flush_request
              @batch_size_bytes += message.length
              @batch << message
            end
            length_met = @batch.length >= @max_length
            size_met = @batch_size_bytes >= @max_bytes
            if is_flush_request || length_met || size_met
              orig = @batch
              clear
            end
          ensure
            @lock.write_lock.unlock
          end
          yield(orig) if block_given? && !orig.nil?
          return orig
        end
def enqueue ( message ) @lock . write_lock . lock orig = nil begin is_flush_request = message . nil? unless is_flush_request @batch_size_bytes += message . length @batch << message end length_met = @batch . length >= @max_length size_met = @batch_size_bytes >= @max_bytes if is_flush_request || length_met || size_met orig = @batch clear end ensure @lock . write_lock . unlock end yield ( orig ) if block_given? && ! orig . nil? return orig end
enqueue adds a message to the batch.
enqueue adds a message to the batch .
message
<not_specific>