Class: WithTransactionalLock::MySqlHelper
- Inherits:
-
Object
- Object
- WithTransactionalLock::MySqlHelper
- Defined in:
- lib/with_transactional_lock/my_sql_helper.rb
Class Method Summary collapse
Class Method Details
.cleanup(klass = ActiveRecord::Base) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/with_transactional_lock/my_sql_helper.rb', line 5 def self.cleanup(klass = ActiveRecord::Base) klass.connection_pool.with_connection do |conn| target_count = conn.select_value('select count(1) from transactional_advisory_locks') count = 0 count += conn.delete('delete from transactional_advisory_locks limit 1000') until count >= target_count end end |