with_advisory_lock
with_advisory_lock copied to clipboard
Naming conflict
The private method included in ActiveRecord has a very generic name and can easily conflict. Is it possible to give it a more specific name?
ActiveRecord::Base.send(:impl_class) #=> WithAdvisoryLock::PostgreSQL
Can you elaborate ?
At the moment, ActiveRecord::Base.send(:impl_class)
is reserved for your library, but the method name doesn't contain "with advisory lock", so it could be easily used by other libraries or application code. Let's say, a pagination library decides that they need their own impl_class
- now there is a conflict. A better name would be something like ActiveRecord::Base.send(:with_advisory_lock_impl_class)
.
Make sense.
I'm refactoring the gem to stop patching Base by default.
With the multiple database support we need to add it to the abstract record or the model that need it locking.
@semaperepelitsa , i opened a PR to fix this.