Changeset 7201
- Timestamp:
- 07/21/07 19:15:58 (1 year ago)
- Files:
-
- tools/capistrano/CHANGELOG (modified) (1 diff)
- tools/capistrano/lib/capistrano/configuration/connections.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/capistrano/CHANGELOG
r7194 r7201 1 1 *SVN* 2 3 * Added "synchronous_connect" setting to try and work around SFTP hangs for certain users [Jamis Buck] 2 4 3 5 * Auto-require the SSH shell service, to avoid race conditions [Jamis Buck] tools/capistrano/lib/capistrano/configuration/connections.rb
r7176 r7201 71 71 failed_servers = [] 72 72 73 # force the connection factory to be instantiated synchronously, 74 # otherwise we wind up with multiple gateway instances, because 75 # each connection is done in parallel. 76 connection_factory 73 # This attemps to work around the problem where SFTP uploads hang 74 # for some people. A bit of investigating seemed to reveal that the 75 # hang only occurred when the SSH connections were established async, 76 # so this setting allows people to at least work around the problem. 77 if fetch(:synchronous_connect, false) 78 logger.trace "synchronous_connect: true" 79 Array(servers).each { |server| safely_establish_connection_to(server, failed_servers) } 80 else 81 # force the connection factory to be instantiated synchronously, 82 # otherwise we wind up with multiple gateway instances, because 83 # each connection is done in parallel. 84 connection_factory 77 85 78 threads = Array(servers).map { |server| establish_connection_to(server, failed_servers) } 79 threads.each { |t| t.join } 86 threads = Array(servers).map { |server| establish_connection_to(server, failed_servers) } 87 threads.each { |t| t.join } 88 end 80 89 81 90 if failed_servers.any? … … 137 146 # variable if the thread just happens to take too long to start up. 138 147 def establish_connection_to(server, failures=nil) 139 Thread.new do140 begin141 sessions[server] ||= connection_factory.connect_to(server) 142 rescue Exception => err143 raise unless failures144 failures << { :server => server, :error => err }145 end146 end148 Thread.new { safely_establish_connection_to(server, failures) } 149 end 150 151 def safely_establish_connection_to(server, failures=nil) 152 sessions[server] ||= connection_factory.connect_to(server) 153 rescue Exception => err 154 raise unless failures 155 failures << { :server => server, :error => err } 147 156 end 148 157 end