Can I specify a timeout value when cancelling a context?
ctx, cancelFunc := context.WithCancel(context.Background()) defer cancelFunc() go publishMetrics(ctx) In my understanding, when the cancelFunc() is invoked, context is cancelled and the go routine receives the signal, but is it allowed for the routine to do some cleanup work? For example, there might be unpublished metrics in memory, the background routine might try to upload them […]