Path: | doc/release_notes/3.41.0.txt |
Last Update: | Sat Aug 17 05:34:45 +0000 2013 |
Checking if connections are valid requires a query, so this extension causes a performance hit. For that reason, connections are only checked by default if they have been inactive for more than a configured amount of time (1 hour by default). You can choose to validate connections on every checkout via:
DB.pool.connection_validation_timeout = -1
However, this can cause a substantial performance hit unless you are purposely using coarse connection checkouts via manual calls to Database#synchronize (for example, in a Rack middleware). Using coarse checkouts can greatly reduce the amount of concurrency that Sequel supports (for example, limiting the number of concurrent requests to the number of database connections), so this method is not without its tradeoffs.
foo = 1 ds = DB[:bar].where(:baz=>foo) # SELECT * FROM bar WHERE (baz = 1) foo = 2 ds # SELECT * FROM bar WHERE (baz = 1)
Using Sequel.delay, you can delay the evaluation:
foo = 1 ds = DB[:bar].where(:baz=>Sequel.delay{foo}) # SELECT * FROM bar WHERE (baz = 1) foo = 2 ds # SELECT * FROM bar WHERE (baz = 2)
This change should not be user-visible, but if you had any code that was monkeying with the connection pool internals, you may need to modify it.