Homebrew addon randomly fails to install packages

If we do not set “update: true” option (i.e. without “brew update”) in homebrew addon, sometimes “Installing Homebrew Packages” fails with “Your Homebrew is outdated. Please run brew update.”
https://travis-ci.org/ruby/ruby/jobs/566961111 (see “Installing Homebrew Packages” step)

If we set “update: true” option, sometimes “brew update” has failed with “No output has been received in the last 10m0s”.
https://travis-ci.org/ruby/ruby/jobs/564916879

Is there an option to make the homebrew addon stable? Should I stop using it and customize installation logic (like adding timeout and retry it with longer backoff with travis_wait) on our own for the time being?