Skip to content

Commit

Permalink
use system_timer gem if installed to prevent 'git fetch origin' from …
Browse files Browse the repository at this point in the history
  • Loading branch information
thewoolleyman committed Dec 18, 2009
1 parent b1de17f commit 9309fc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions config/initializers/system_timer.rb
@@ -0,0 +1,10 @@
# If installed, use SystemTimer to avoid git.rb causing builder to hang due to intermittent network issues. See:
# https://cruisecontrolrb.lighthouseapp.com/projects/9150-cruise-control-rb/tickets/229-sometimes-git-hangs
# http://ph7spot.com/musings/system-timer
begin
require 'system_timer'
MyTimer = SystemTimer
rescue LoadError
require 'timeout'
MyTimer = Timeout
end
4 changes: 3 additions & 1 deletion lib/source_control/git.rb
Expand Up @@ -94,7 +94,9 @@ def filter_revisions_by_subdirectory(revisions, subdir)
end

def load_new_changesets_from_origin
Timeout.timeout(Configuration.git_load_new_changesets_timeout, Timeout::Error) do
# NOTE: Git network problems may cause CruiseControl.rb to hang unless you install the system_timer gem.
# See: https://cruisecontrolrb.lighthouseapp.com/projects/9150-cruise-control-rb/tickets/229-sometimes-git-hangs
MyTimer.timeout(Configuration.git_load_new_changesets_timeout) do
git("fetch", ["origin"])
end
rescue Timeout::Error => e
Expand Down

0 comments on commit 9309fc5

Please sign in to comment.