Skip to content

Commit e50450e

Browse files
committed
feat: add release_all_locks
1 parent 5b1ed5a commit e50450e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/with_advisory_lock/mysql.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def release_lock
1515
execute_successful?("RELEASE_LOCK(#{quoted_lock_str})")
1616
end
1717

18+
def release_all_locks
19+
execute_query("RELEASE_ALL_LOCKS()")
20+
end
21+
1822
def execute_successful?(mysql_function)
1923
execute_query(mysql_function) == 1
2024
end

lib/with_advisory_lock/postgresql.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def release_lock
2929
end
3030
end
3131

32+
def release_all_locks
33+
connection.execute("SELECT pg_advisory_unlock_all()")
34+
end
35+
3236
def advisory_try_lock_function(transaction_scope)
3337
[
3438
'pg_try_advisory',

0 commit comments

Comments
 (0)