lib/vertica/connection.rb in vertica-0.11.0 vs lib/vertica/connection.rb in vertica-0.11.1

- old
+ new

@@ -68,11 +68,10 @@ def ready_for_query? !busy? end def write_message(message) - raise ArgumentError, "invalid message: (#{message.inspect})" unless message.respond_to?(:to_bytes) puts "=> #{message.inspect}" if @debug write_bytes message.to_bytes rescue SystemCallError, IOError => e close_socket raise Vertica::Error::ConnectionError.new(e.message) @@ -178,10 +177,15 @@ protected def run_with_mutex(job) boot_connection if closed? if @mutex.try_lock - job.run + begin + job.run + rescue StandardError + @mutex.unlock if @mutex.locked? + raise + end else raise Vertica::Error::SynchronizeError.new(job) end end