Skip to content

Commit 8f0043c

Browse files
committed
reduce timeout from 2 minutes to 30 seconds
1 parent d1a8959 commit 8f0043c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd_bkwatch.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type bkWatchConfig struct {
2525
jobID string
2626
}
2727

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

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

@@ -216,7 +218,7 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
216218
// reset the check counter so we try again next time we think we're
217219
// finished.
218220
passed = false
219-
checksLeft = numChecks
221+
checksLeft = numBKChecks
220222
}
221223
}()
222224

0 commit comments

Comments
 (0)