Skip to content

Suppress context cancellation/expiration

Pavlo Strokov requested to merge ps-suppress-cancellation into master

As we are moving code from ruby to go and replicate the same behaviour as a first step in that process we should use a cleanup operations to rollback any changes we do as a preparation steps before execution of actual operations on the repository (like setup of config values). To do that we are using git.SafeCmd to interact with the repository and it requires context.Context to be passed for execution. But we can't use same context we used to run operation as cleaning steps could be terminated in case context is cancelled or expired. At the same time we require to have all configurations set on the context in order to run commands without issues. Added SuppressCancellation allows to suppress cancellation or expiration of the parent context and re-use all its values. We should wrap actual context with SuppressCancellation in the calls to revert changes done on setup stage to prevent them from being terminated due to time limits of the request or cancellation.

Closes: #3276 (closed)

Merge request reports