File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 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 {
188188 case <- ctx .Done ():
189189 return true
190190 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 )
192201 if ! ok {
202+ // programming error, should never happen
193203 return false
194204 }
195205
196- if didFinishSync != nil && * didFinishSync {
206+ if didFinishSyncPtr != nil && * didFinishSyncPtr {
197207 // event sources finished syncing successfully
198208 return true
199209 }
Original file line number Diff line number Diff line change @@ -1229,7 +1229,6 @@ var _ = Describe("controller", func() {
12291229 }
12301230
12311231 By ("Starting a blocking warmup" )
1232-
12331232 go func () {
12341233 defer GinkgoRecover ()
12351234 Expect (ctrl .Warmup (ctx )).To (Succeed ())
@@ -1238,6 +1237,7 @@ var _ = Describe("controller", func() {
12381237 // didWaitForWarmupCompleteReturn is true when the call to WaitForWarmupComplete returns
12391238 didWaitForWarmupCompleteReturn := atomic.Bool {}
12401239 go func () {
1240+ defer GinkgoRecover ()
12411241 // Verify WaitForWarmupComplete returns true for successful sync
12421242 Expect (ctrl .WaitForWarmupComplete (ctx )).To (BeTrue ())
12431243 didWaitForWarmupCompleteReturn .Store (true )
You can’t perform that action at this time.
0 commit comments