Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip checking for updates for completion commands #554

Merged
merged 1 commit into from
May 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/fastly/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/fastly/cli/pkg/app"
"github.com/fastly/cli/pkg/check"
"github.com/fastly/cli/pkg/cmd"
"github.com/fastly/cli/pkg/commands/update"
"github.com/fastly/cli/pkg/config"
fsterr "github.com/fastly/cli/pkg/errors"
Expand Down Expand Up @@ -141,7 +142,10 @@ func main() {
var errLoadConfig error

// Validate if configuration is older than its TTL
if check.Stale(file.CLI.LastChecked, file.CLI.TTL) {
// NOTE: We don't want to trigger a config check when the user is making an
// autocomplete request because this can add additional latency to the user's
// shell loading completely.
if check.Stale(file.CLI.LastChecked, file.CLI.TTL) && !cmd.IsCompletion(args) && !cmd.IsCompletionScript(args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice, I forgot I had moved that stuff into a separate package 🙂

if verboseOutput {
text.Info(out, `
Compatibility and versioning information for the Fastly CLI is being updated in the background. The updated data will be used next time you execute a fastly command.
Expand Down