Skip to content

Commit

Permalink
Handle build timeouts, make timeout configurable per app
Browse files Browse the repository at this point in the history
  • Loading branch information
rwz committed Dec 18, 2014
1 parent 605dbd7 commit 0ff1dfe
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions lib/ember-cli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,46 @@ def wait
Timeout.timeout(build_timeout) do
sleep 0.1 while lockfile.exist?
end
end
rescue Timeout::Error
suggested_timeout = build_timeout + 5

private
warn <<-MSG.strip_heredoc
============================= WARNING! =============================
def lockfile
app_path.join("tmp", "build.lock")
Seems like Ember #{name} application takes more than #{build_timeout}
seconds to compile.
To prevent race conditions consider adjusting build timeout
configuration in your ember initializer:
EmberCLI.configure do |config|
config.build_timeout = #{suggested_timeout} # in seconds
end
Alternatively, you can set build timeout per application like this:
EmberCLI.configure do |config|
config.app :#{name}, build_timeout: #{suggested_timeout}
end
============================= WARNING! =============================
MSG
end

private

delegate :ember_path, to: :configuration
delegate :build_timeout, to: :configuration
delegate :tee_path, to: :configuration
delegate :configuration, to: :EmberCLI

def build_timeout
options.fetch(:build_timeout){ configuration.build_timeout }
end

def lockfile
app_path.join("tmp", "build.lock")
end

def prepare
@prepared ||= begin
check_addon!
Expand Down

0 comments on commit 0ff1dfe

Please sign in to comment.