aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/reaper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* fix activerecord reaper_testVladimir Dementyev2019-01-021-1/+1
|
* Improve tests for ActiveRecord::ConnectionAdapters::ConnectionPool ↵Guo Xiang Tan2018-08-191-2/+2
| | | | configurations.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-3/+3
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-2/+2
|
* Flush idle database connectionsMatthew Draper2017-11-261-0/+6
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* fix issue with reaping_frequency typekorbin2014-12-171-1/+1
| | | | | | | | When using DATABASE_URL to configure ActiveRecord, :reaping_frequency does not get converted from a string to a numeric value. This value is eventually passed to 'sleep' and must be numeric to avoid exceptions. This commit converts :reaping_frequency to a float when present.
* Reap connections based on owning-thread deathMatthew Draper2014-03-181-6/+11
| | | | | | | | | | | | | | | | .. not a general timeout. Now, if a thread checks out a connection then dies, we can immediately recover that connection and re-use it. This should alleviate the pool exhaustion discussed in #12867. More importantly, it entirely avoids the potential issues of the reaper attempting to check whether connections are still active: as long as the owning thread is alive, the connection is its business alone. As a no-op reap is now trivial (only entails checking a thread status per connection), we can also perform one in-line any time we decide to sleep for a connection.
* Use teardown helper method.Guo Xiang Tan2014-03-141-2/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* Reaper has access to threadsafe active? callKevin Casey2014-02-081-1/+1
|
* ConnectionPool wait_timeout no longer used for different types of timeouts. ↵Jonathan Rochkind2012-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #6441 An AR ConnectionSpec `wait_timeout` is pre-patch used for three different things: * mysql2 uses it for MySQL's own wait_timeout (how long MySQL should allow an idle connection before closing it), and defaults to 2592000 seconds. * ConnectionPool uses it for "number of seconds to block and wait for a connection before giving up and raising a timeout error", default 5 seconds. * ConnectionPool uses it for the Reaper, for deciding if a 'dead' connection can be reaped. Default 5 seconds. Previously, if you want to change these from defaults, you need to change them all together. This is problematic _especially_ for the mysql2/ConnectionPool conflict, you will generally _not_ want them to be the same, as evidenced by their wildly different defaults. This has caused real problems for people #6441 #2894 But as long as we're changing this, forcing renaming the ConnectionPool key to be more specific, it made sense to seperate the two ConnectionPool uses too -- these two types of ConnectionPool timeouts ought to be able to be changed independently, you won't neccesarily want them to be the same, even though the defaults are (currently) the same.
* rename start to run and use Thread.pass rather than sleeping to schedule the ↵Aaron Patterson2011-12-301-21/+29
| | | | watchdog
* connection pool starts the reaperAaron Patterson2011-12-301-0/+16
|
* just dup the spec now that it will deep copyAaron Patterson2011-12-301-2/+1
|
* each connection pool has a reaperAaron Patterson2011-12-301-0/+12
|
* introduce a timer class for reaping connectionsAaron Patterson2011-12-301-0/+46