lib/google/cloud/logging/async_writer.rb in google-cloud-logging-1.4.0 vs lib/google/cloud/logging/async_writer.rb in google-cloud-logging-1.5.0

- old
+ new

@@ -85,11 +85,11 @@ ## # The current state. Either :running, :suspended, :stopping, or :stopped # # DEPRECATED. Use #async_state instead. - alias_method :state, :async_state + alias state async_state ## # The last exception thrown by the background thread, or nil if nothing # has been thrown. attr_reader :last_exception @@ -150,11 +150,11 @@ # def write_entries entries, log_name: nil, resource: nil, labels: nil ensure_thread entries = Array(entries) synchronize do - fail "AsyncWriter has been stopped" unless writable? + raise "AsyncWriter has been stopped" unless writable? queue_item = QueueItem.new entries, log_name, resource, labels if @queue.empty? || !@queue.last.try_combine(queue_item) @queue.push queue_item end @queue_size += entries.size @@ -211,11 +211,11 @@ # DEPRECATED. Use #async_stop instead. # # @return [Boolean] Returns true if the writer was running, or false # if the writer had already been stopped. # - alias_method :stop, :async_stop + alias stop async_stop ## # Suspends this asynchronous writer. # # After this call succeeds, the state will change to :suspended, and @@ -224,11 +224,11 @@ # DEPRECATED. Use #async_suspend instead. # # @return [Boolean] Returns true if the writer had been running and was # suspended, otherwise false. # - alias_method :suspend, :async_suspend + alias suspend async_suspend ## # Resumes this suspended asynchronous writer. # # After this call succeeds, the state will change to :running, and @@ -237,48 +237,48 @@ # DEPRECATED. Use #async_resume instead. # # @return [Boolean] Returns true if the writer had been suspended and # is now running, otherwise false. # - alias_method :resume, :async_resume + alias resume async_resume ## # Returns true if this writer is running. # # DEPRECATED. Use #async_running? instead. # # @return [Boolean] Returns true if the writer is currently running. # - alias_method :running?, :async_running? + alias running? async_running? ## # Returns true if this writer is suspended. # # DEPRECATED. Use #async_suspended? instead. # # @return [Boolean] Returns true if the writer is currently suspended. # - alias_method :suspended?, :async_suspended? + alias suspended? async_suspended? ## # Returns true if this writer is still accepting writes. This means # it is either running or suspended. # # DEPRECATED. Use #async_working? instead. # # @return [Boolean] Returns true if the writer is accepting writes. # - alias_method :writable?, :async_working? + alias writable? async_working? ## # Returns true if this writer is fully stopped. # # DEPRECATED. Use #async_stopped? instead. # # @return [Boolean] Returns true if the writer is fully stopped. # - alias_method :stopped?, :async_stopped? + alias stopped? async_stopped? ## # Blocks until this asynchronous writer has been stopped, or the given # timeout (if present) has elapsed. # @@ -288,11 +288,11 @@ # timeout. # # @return [Boolean] Returns true if the writer is stopped, or false # if the timeout expired. # - alias_method :wait_until_stopped, :wait_until_async_stopped + alias wait_until_stopped wait_until_async_stopped ## # Stop this asynchronous writer and block until it has been stopped. # # DEPRECATED. Use #async_stop! instead. @@ -338,10 +338,10 @@ log_name: queue_item.log_name, resource: queue_item.resource, labels: queue_item.labels, partial_success: @partial_success ) - rescue => e + rescue StandardError => e # Ignore any exceptions thrown from the background thread, but # keep running to ensure its state behavior remains consistent. @last_exception = e end end