File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,14 @@ func (sgc *StoreGrantCoordinators) TryGetSnapshotQueueForStore(storeID roachpb.S
276
276
func (sgc * StoreGrantCoordinators ) close () {
277
277
// closeCh can be nil in tests that never called SetPebbleMetricsProvider.
278
278
if sgc .closeCh != nil {
279
+ // Ensure that the goroutine has observed the close and will no longer
280
+ // call GetPebbleMetrics, since the engines will be closed soon after this
281
+ // method returns, and calling GetPebbleMetrics on closed engines is not
282
+ // permitted.
283
+ sgc .closeCh <- struct {}{}
284
+ // Close the channel, so that if close gets called twice due to a bug,
285
+ // sending on the closed channel will panic instead of the send being
286
+ // blocked forever.
279
287
close (sgc .closeCh )
280
288
}
281
289
You can’t perform that action at this time.
0 commit comments