File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -188,12 +188,22 @@ func (c *Controller[request]) WaitForWarmupComplete(ctx context.Context) bool {
188
188
case <- ctx .Done ():
189
189
return true
190
190
case <- ticker .C :
191
- didFinishSync , ok := c .didEventSourcesFinishSyncSuccessfully .Load ().(* bool )
191
+ didFinishSync := c .didEventSourcesFinishSyncSuccessfully .Load ()
192
+ if didFinishSync == nil {
193
+ // event source still syncing
194
+ continue
195
+ }
196
+
197
+ // This *bool assertion is done after checking for nil because type asserting a nil
198
+ // interface as a *bool will return false, which is not what we want since nil should be
199
+ // treated as not finished syncing.
200
+ didFinishSyncPtr , ok := didFinishSync .(* bool )
192
201
if ! ok {
202
+ // programming error, should never happen
193
203
return false
194
204
}
195
205
196
- if didFinishSync != nil && * didFinishSync {
206
+ if didFinishSyncPtr != nil && * didFinishSyncPtr {
197
207
// event sources finished syncing successfully
198
208
return true
199
209
}
Original file line number Diff line number Diff line change @@ -1229,7 +1229,6 @@ var _ = Describe("controller", func() {
1229
1229
}
1230
1230
1231
1231
By ("Starting a blocking warmup" )
1232
-
1233
1232
go func () {
1234
1233
defer GinkgoRecover ()
1235
1234
Expect (ctrl .Warmup (ctx )).To (Succeed ())
@@ -1238,6 +1237,7 @@ var _ = Describe("controller", func() {
1238
1237
// didWaitForWarmupCompleteReturn is true when the call to WaitForWarmupComplete returns
1239
1238
didWaitForWarmupCompleteReturn := atomic.Bool {}
1240
1239
go func () {
1240
+ defer GinkgoRecover ()
1241
1241
// Verify WaitForWarmupComplete returns true for successful sync
1242
1242
Expect (ctrl .WaitForWarmupComplete (ctx )).To (BeTrue ())
1243
1243
didWaitForWarmupCompleteReturn .Store (true )
You can’t perform that action at this time.
0 commit comments