1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00
Commit graph

20 commits

Author SHA1 Message Date
Myles Megyesi
b827403858 Do not incremented @created object counter in TimedStack before object creation actually succeeds.
In the case that object creation throws an exception, the `@created` counter was still being incremented, effectively taking up a slot in the pool forever.
2015-03-13 09:32:59 -05:00
Eric Hodel
0ebb059111 Restore 2.0 compatibility of TimedStack#pop
This also supports forward-compatibility through use of timeout as a
keyword argument.
2014-03-24 16:03:16 -07:00
Eric Hodel
97f42e8b41 Pass options through TimedStack methods to hooks
This allows the hooks to do arbitrary things based on options (keyword
arguments) such as creating a particular type of connection based on,
say, connection_args.

The ** syntax for arbitrary options is not used as it is not supported
on ruby 1.9.
2014-03-18 20:45:08 -07:00
Damian Janowski
341c185ec0 Require proper files. 2014-03-13 22:56:16 -03:00
Eric Hodel
708ab9a6c4 ConnectionPool::TimedStack is now lazy
Now TimedStack only creates connections when the internal queue is empty
and the number of connections is less than the maximum set.  By default
no connections are created when the pool is created.

This required some changes to the TimedStack tests because I wrote poor
tests the first time around.  The new tests better exercise the intended
behavior of TimedStack.

This required some changes to the ConnectionPool tests to use up
connections because now an unused pool has no connections.
2014-02-17 16:25:22 -08:00
Eric Hodel
facd3d3a4c Test TimedStack#length with a sized stack 2014-02-17 14:47:41 -08:00
Eric Hodel
42ac8d5608 Test TimedStack#empty? with a sized stack 2014-02-17 14:45:57 -08:00
Eric Hodel
c93190bb80 Test TimedStack#pop with a precreated item
This test was missed during my initial pass.  If the @que assignment
in #initialize is changed no tests fail so this test is necessary.
2014-02-17 14:34:51 -08:00
Eric Hodel
5d27389df9 Match style from test_connection_pool.rb 2014-02-06 19:06:16 -08:00
Eric Hodel
2c52af7dee Do not wait at all for pop 2014-02-06 19:02:06 -08:00
Eric Hodel
ca07980e46 Test TimedStack#pop when waiting for a push 2014-02-06 18:47:33 -08:00
Eric Hodel
16334ab517 Test TimedStack#pop after shutdown 2014-02-06 18:21:28 -08:00
Eric Hodel
5be329da9b Test TimedStack#pop with an item 2014-02-06 18:20:23 -08:00
Eric Hodel
53ef10798e Test TimedStack#push after shutdown independently
This is a partial refactor of test_shutdown
2014-02-06 18:17:59 -08:00
Eric Hodel
aab23e1e56 Test TimedStack#shutdown 2014-02-06 18:16:25 -08:00
Eric Hodel
2422e04936 Test TimedStack#length 2014-02-06 18:10:58 -08:00
Eric Hodel
cdfb9a7e41 Test TimedStack#empty? 2014-02-06 18:10:29 -08:00
Eric Hodel
f5fca5a41f Alphabetize tests 2014-02-06 18:09:45 -08:00
Eric Hodel
8d8554ce7b Test TimedStack#pop 2014-02-06 18:07:58 -08:00
Eric Hodel
bb22327529 Test TimedStack#push 2014-02-06 18:05:45 -08:00