Skip to navigation
How to install busy_handler for SQLite3
07.12.13
here's a SQLite driver call busy_timeout() which just retries any busy lookup up to a certain time limit, for example busy_timeout(2000) will retry up to 2 seconds. In app/models, create retry_model.rb: class RetryModel < ActiveRecord::Base self.abstract_class = true self.connection.raw_connection.busy_timeout(2000) if self.connection.adapter_name == 'SQLite' end Then in all your models, change them to derive from retry_model instead of ActiveRecord::Base, eg, chage: class MyModel < ActiveRecord::Base to: class MyModel < RetryModel Posted by Michael Meckler
Reply
Anonymous
how to install busy_handler for SQLite3
here's a SQLite driver call busy_timeout() which just retries any busy lookup up to a certain time limit, for example busy_timeout(2000) will retry up to 2 seconds. In app/models, create retry_model.rb: class RetryModel < ActiveRecord::Base self.abstract_class = true self.connection.raw_connection.busy_timeout(2000) if self.connection.adapter_name == 'SQLite' end Then in all your models, change them to derive from retry_model instead of ActiveRecord::Base, eg, chage: class MyModel < ActiveRecord::Base to: class MyModel < RetryModel Posted by Michael Meckler
07.12.13
Reply
Anonymous
Information Epoch 1732361806
Portable data is as important as portable code.
Home
Notebook
Contact us