fix(durable): cancel takeover cooling when provider closes

This commit is contained in:
pingqiu committed 2026-11-20 01:40:49 -08:00
1 parent dbfa9424ae
commit 271b98eb2c
1 file changed
+4
@@ -328,6 +328,10 @@ func (p *DurableProvider) startChunkLoop(volumeID string, h *volHandle, layer st
}
func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h *volHandle) (storage.ChunkLayer, error) {
// Close cancels local takeover cooling as well as each bound remote RPC.
ctx, cancelAttach := context.WithCancel(ctx)
stopClose := context.AfterFunc(p.closeCtx, cancelAttach)
defer func() { stopClose(); cancelAttach() }()
ws, ok := h.storage.(*storage.WALStore)
if !ok {
return nil, fmt.Errorf("durable: %s storage is %T, not a walstore", ImplWALStoreChunk, h.storage)