mirror of
https://github.com/gosticks/brew.git
synced 2026-10-06 23:46:56 +00:00
Improve speed of HOMEBREW_AUTO_UPDATE_SECS
This variable allows a user to configure how often `brew update` runs. With the previous implementation, however, it was still pretty slow as it would run some of `brew update` even within the timeout. This feels related to complaints about Homebrew "feeling slow" since we enabled this. Address this by: - making `HOMEBREW_AUTO_UPDATE_SECS` behave more like `HOMEBREW_NO_AUTO_UPDATE` and entirely skip the invocation of `brew update` if the relevant tap (homebrew-core or homebrew-cask depending on command invoked) has been checked in the last `HOMEBREW_AUTO_UPDATE_SECS` - Only require/check the update of a single tap rather than every tap - Increase the default value of `HOMEBREW_AUTO_UPDATE_SECS` from 1m to 5m to cut people a bit more slack. We're not updating things often enough for 1m not to feel a bit overkill and 5m feels appropriate for a Homebrew "session" to only require a single update.
This commit is contained in:
@@ -337,7 +337,7 @@ EOS
|
||||
|
||||
if [[ -z "$HOMEBREW_AUTO_UPDATE_SECS" ]]
|
||||
then
|
||||
HOMEBREW_AUTO_UPDATE_SECS="60"
|
||||
HOMEBREW_AUTO_UPDATE_SECS="300"
|
||||
fi
|
||||
|
||||
# check permissions
|
||||
@@ -451,12 +451,6 @@ EOS
|
||||
# origin branch name is, and use that. If not set, fall back to "master".
|
||||
# the refspec ensures that the default upstream branch gets updated
|
||||
(
|
||||
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||
then
|
||||
# Skip taps checked/fetched recently
|
||||
[[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]] && exit
|
||||
fi
|
||||
|
||||
UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"
|
||||
if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]
|
||||
then
|
||||
|
||||
Reference in New Issue
Block a user