Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #332 from jpfuentes2/fix_overzealous_shell_loop

Fix shell bug causing CPU 100%
  • Loading branch information...
commit 50d2c9df612ea84562380e503a1ce64b5b734837 2 parents 3ed9053 + f2a787c
@carsomyr carsomyr authored
Showing with 6 additions and 2 deletions.
  1. +3 −1 lib/capistrano/processable.rb
  2. +3 −1 lib/capistrano/shell.rb
View
4 lib/capistrano/processable.rb
@@ -23,6 +23,8 @@ def process_iteration(wait=nil, &block)
if readers.any? || writers.any?
readers, writers, = IO.select(readers, writers, nil, wait)
+ else
+ return false
end
if readers
@@ -50,4 +52,4 @@ def ensure_each_session
sessions
end
end
-end
+end
View
4 lib/capistrano/shell.rb
@@ -199,11 +199,13 @@ def reader
# thread and generally gets things ready for the REPL.
def setup
configuration.logger.level = Capistrano::Logger::INFO
+ wait_for = 0.1
@mutex = Mutex.new
@bgthread = Thread.new do
loop do
- @mutex.synchronize { process_iteration(0.1) }
+ ret = @mutex.synchronize { process_iteration(wait_for) }
+ sleep wait_for if !ret
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.