Skip to content

Commit 89b8d63

Browse files
committed
skip spinning up eviction loop if caching is not enabled
1 parent ac18160 commit 89b8d63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/sshkit/backends/connection_pool.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)