diff options
author | Sam Davies <seivadmas@gmail.com> | 2015-11-18 11:53:38 -0300 |
---|---|---|
committer | Sam Davies <seivadmas@gmail.com> | 2015-11-18 12:00:58 -0300 |
commit | 5ce21d4f72e72f8acdd5b849425a9475733d4d11 (patch) | |
tree | b0b55117137837f7e280cdffeaede36614032d1c /activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | |
parent | ce37df9cc1f2c3cdc63dc677645bdfec05c787fe (diff) | |
download | rails-5ce21d4f72e72f8acdd5b849425a9475733d4d11.tar.gz rails-5ce21d4f72e72f8acdd5b849425a9475733d4d11.tar.bz2 rails-5ce21d4f72e72f8acdd5b849425a9475733d4d11.zip |
Rename 'key' to 'lock_id' or 'lock_name' for advisory locking
- key was a poor choice of name. A key implies something that will
unlock a lock. The concept is actually more like a 'lock identifier'
- mysql documentation calls this a 'lock name'
- postgres documentation calls it a 'lock_id'
- Updated variable names to reflect the preferred terminology for the database in
question
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index c75c9ab3b5..deef246c37 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -224,12 +224,12 @@ module ActiveRecord version >= '5.0.0' end - def get_advisory_lock(key, timeout = 0) # :nodoc: - select_value("SELECT GET_LOCK('#{key}', #{timeout});").to_s == '1' + def get_advisory_lock(lock_name, timeout = 0) # :nodoc: + select_value("SELECT GET_LOCK('#{lock_name}', #{timeout});").to_s == '1' end - def release_advisory_lock(key) # :nodoc: - select_value("SELECT RELEASE_LOCK('#{key}')").to_s == '1' + def release_advisory_lock(lock_name) # :nodoc: + select_value("SELECT RELEASE_LOCK('#{lock_name}')").to_s == '1' end def native_database_types |