ClosureTree / with_advisory_lock

Advisory locking for ActiveRecord
http://closuretree.github.io/with_advisory_lock/
MIT License
619 stars 68 forks source link

Naming conflict #83

Open semaperepelitsa opened 9 months ago

semaperepelitsa commented 9 months ago

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
seuros commented 8 months ago

Can you elaborate ?

semaperepelitsa commented 8 months ago

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).

seuros commented 8 months ago

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.

seuros commented 7 months ago

@semaperepelitsa , i opened a PR to fix this.