You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Gracefully shutdown agent (#3895)
This commit is contained in:
@@ -105,7 +105,11 @@ func (r *Runtime) Run(runnerCtx context.Context) error {
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := r.engine.DestroyWorkflow(runnerCtx, r.spec, r.taskUUID); err != nil {
|
||||
ctx := runnerCtx //nolint:contextcheck
|
||||
if ctx.Err() != nil {
|
||||
ctx = GetShutdownCtx()
|
||||
}
|
||||
if err := r.engine.DestroyWorkflow(ctx, r.spec, r.taskUUID); err != nil {
|
||||
logger.Error().Err(err).Msg("could not destroy engine")
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user