Skip to content

Commit

Permalink
reduce timeout from 2 minutes to 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzdan committed May 9, 2024
1 parent d1a8959 commit 8f0043c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd_bkwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type bkWatchConfig struct {
jobID string
}

const numBKChecks = 6

func commandBKWatch(cfg *libhoney.Config, filename *string, ciProvider *string) *cobra.Command {
// WATCH eg: buildevents bk_watch $BUILDKITE_BUILD_ID
var wcfg bkWatchConfig
Expand Down Expand Up @@ -159,8 +161,8 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
// In that case there are no jobs running and some jobs blocked that could
// still run. If we think the build has passed and finished, let's give it a
// buffer to spin up new jobs before really considering it done. This buffer
// will check for up to 2 minutes
checksLeft := numChecks + 1 // +1 because we decrement at the beginning of the loop
// will check for up to 30 seconds
checksLeft := numBKChecks + 1 // +1 because we decrement at the beginning of the loop

go func() {
defer close(done)
Expand All @@ -179,7 +181,7 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
anyRunning, anyFailed, err := bkCheckJobs(client, cfg)
if !anyRunning {
// if this is the first time we think we're finished store the timestamp
if checksLeft >= numChecks {
if checksLeft >= numBKChecks {
ended = time.Now()
}

Expand Down Expand Up @@ -216,7 +218,7 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
// reset the check counter so we try again next time we think we're
// finished.
passed = false
checksLeft = numChecks
checksLeft = numBKChecks
}
}()

Expand Down

0 comments on commit 8f0043c

Please sign in to comment.