Open AmitKumarDas opened 4 years ago
In Go, a long running or expensive operation typically accepts a context that the consumer can use to cancel (stop) the operation.
ctx, cancel := context.WithTimeout(context.Background(), h.Timeout) defer cancel() publishInfo, _, err := h.attacher.Attach( ctx, volumeHandle, readOnly, nodeID, volumeCapabilities, attributes, secrets, ) if err != nil { return va, nil, err }
In Go, a long running or expensive operation typically accepts a context that the consumer can use to cancel (stop) the operation.