@@ -25,6 +25,8 @@ type bkWatchConfig struct {
25
25
jobID string
26
26
}
27
27
28
+ const numBKChecks = 6
29
+
28
30
func commandBKWatch (cfg * libhoney.Config , filename * string , ciProvider * string ) * cobra.Command {
29
31
// WATCH eg: buildevents bk_watch $BUILDKITE_BUILD_ID
30
32
var wcfg bkWatchConfig
@@ -159,8 +161,8 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
159
161
// In that case there are no jobs running and some jobs blocked that could
160
162
// still run. If we think the build has passed and finished, let's give it a
161
163
// 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
164
166
165
167
go func () {
166
168
defer close (done )
@@ -179,7 +181,7 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
179
181
anyRunning , anyFailed , err := bkCheckJobs (client , cfg )
180
182
if ! anyRunning {
181
183
// if this is the first time we think we're finished store the timestamp
182
- if checksLeft >= numChecks {
184
+ if checksLeft >= numBKChecks {
183
185
ended = time .Now ()
184
186
}
185
187
@@ -216,7 +218,7 @@ func waitBuildkite(parent context.Context, cfg bkWatchConfig) (passed bool, star
216
218
// reset the check counter so we try again next time we think we're
217
219
// finished.
218
220
passed = false
219
- checksLeft = numChecks
221
+ checksLeft = numBKChecks
220
222
}
221
223
}()
222
224
0 commit comments