135
})
136
}
138
>
if r.dataReady.CompareAndSwap(oldReady, nil) {
139
>
oldReady.refresh.Cancel()
140
>
<-oldReady.refresh.Done()
141
>
// If oldReady.ready was not already closed here, callers blocked in waitUntilInitialized
142
>
// will block indefinitely (until context timeout). If we wanted to wake them up, we
143
>
// could close ready here, but we would need to use a sync.Once to avoid closing it
144
>
// twice. Then waitUntilInitialized would need to reload r.dataReady to check that the
145
>
// wakeup was due to data being ready rather than this close.
146
>
}
147
}
148
}