Sha256: 448d59dc4d5271493c1b4ff99674dda3dc924d7782fb3767c3dc9d13f8cd79e9

Contents?: true

Size: 1001 Bytes

Versions: 5

Compression:

Stored size: 1001 Bytes

Contents

# -*- ruby -*-
# frozen_string_literal: true

require 'pg' unless defined?( PG )

if defined?(PG::CancelConnection)
	class PG::CancelConnection
		include PG::Connection::Pollable

		# The timeout used by #cancel and async_cancel to establish the cancel connection.
		attr_accessor :async_connect_timeout

		# call-seq:
		#    conn.cancel
		#
		# Requests that the server abandons processing of the current command in a blocking manner.
		#
		# If the cancel request wasn't successfully dispatched an error message is raised.
		#
		# Successful dispatch of the cancellation is no guarantee that the request will have any effect, however.
		# If the cancellation is effective, the command being canceled will terminate early and raises an error.
		# If the cancellation fails (say, because the server was already done processing the command), then there will be no visible result at all.
		#
		def cancel
			start
			polling_loop(:poll, async_connect_timeout)
		end
		alias async_cancel cancel
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg-1.6.0.rc1-x86_64-linux lib/pg/cancel_connection.rb
pg-1.6.0.rc1-x86-mingw32 lib/pg/cancel_connection.rb
pg-1.6.0.rc1-x64-mingw32 lib/pg/cancel_connection.rb
pg-1.6.0.rc1-x64-mingw-ucrt lib/pg/cancel_connection.rb
pg-1.6.0.rc1 lib/pg/cancel_connection.rb