We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00f1cfe commit 727cbebCopy full SHA for 727cbeb
lib/with_advisory_lock/postgresql.rb
@@ -5,6 +5,9 @@ class PostgreSQL < Base
5
# See http://www.postgresql.org/docs/9.1/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
6
def try_lock
7
pg_function = "pg_try_advisory#{transaction ? '_xact' : ''}_lock#{shared ? '_shared' : ''}"
8
+
9
+ raise "#{pg_function} requires transaction" unless ActiveRecord::Base.within_transaction?
10
11
execute_successful?(pg_function)
12
end
13
0 commit comments