File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ appear at the top.
66## [ Unreleased] [ ]
77
88 * Your contribution here!
9+ * [ #448 ] ( https://github.com/capistrano/sshkit/pull/448 ) : Fix misbehaving connection eviction loop when disabling connection pooling - [ Sebastian Cohnen] ( https://github.com/tisba )
910
1011## [ 1.18.1] [ ] (2019-01-26)
1112
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def inspect
2121
2222# The ConnectionPool caches connections and allows them to be reused, so long as
2323# the reuse happens within the `idle_timeout` period. Timed out connections are
24- # closed, forcing a new connection to be used in that case.
24+ # eventually closed, forcing a new connection to be used in that case.
2525#
2626# Additionally, a background thread is started to check for abandoned
2727# connections that have timed out without any attempt at being reused. These
@@ -46,7 +46,11 @@ def initialize(idle_timeout=30)
4646 @caches = { }
4747 @caches . extend ( MonitorMixin )
4848 @timed_out_connections = Queue . new
49- Thread . new { run_eviction_loop }
49+
50+ # Spin up eviction loop only if caching is enabled
51+ if cache_enabled?
52+ Thread . new { run_eviction_loop }
53+ end
5054 end
5155
5256 # Creates a new connection or reuses a cached connection (if possible) and
@@ -133,7 +137,7 @@ def run_eviction_loop
133137 process_deferred_close
134138
135139 # Periodically sweep all Caches to evict stale connections
136- sleep ( [ idle_timeout , 5 ] . min )
140+ sleep ( 5 )
137141 caches . values . each ( &:evict )
138142 end
139143 end
You can’t perform that action at this time.
0 commit comments