lib/google/cloud/logging/async_writer.rb in google-cloud-logging-2.1.0 vs lib/google/cloud/logging/async_writer.rb in google-cloud-logging-2.2.0

- old
+ new

@@ -63,11 +63,11 @@ attr_reader :logging, :max_bytes, :max_count, :interval, :threads, :max_queue, :partial_success ## # @private Creates a new AsyncWriter instance. - def initialize logging, max_count: 10000, max_bytes: 10000000, + def initialize logging, max_count: 10_000, max_bytes: 10_000_000, max_queue: 100, interval: 5, threads: 10, partial_success: false # init MonitorMixin super() @@ -208,11 +208,11 @@ break if @stopped @stopped = true publish_batch! @cond.broadcast - @thread_pool.shutdown if @thread_pool + @thread_pool&.shutdown end self end @@ -455,11 +455,12 @@ end ## # @private class Batch - attr_reader :created_at, :entries + attr_reader :created_at + attr_reader :entries def initialize writer @writer = writer @entries = [] @entries_bytes = 2 # initial size w/ partial_success @@ -497,10 +498,10 @@ @created_at + @writer.interval end def publish_wait publish_wait = publish_at - Time.now - return 0 if publish_wait < 0 + return 0 if publish_wait.negative? publish_wait end def addl_bytes_for entry entry.to_grpc.to_proto.bytesize + 2