Remove usage of context.DeadlineExceeded
for internal decisions as this error is strongly used by other packages. By checking such wrapped errors the internal decision can be influenced accidentally. In this case the retry mechanism checked if the error is context.DeadlineExceeded and assumed it would be created by the internal context. This assumption was wrong.
This commit is contained in:

committed by
Sebastian Serth

parent
6b69a2d732
commit
d0dd5c08cb
@ -342,6 +342,9 @@ func (r *NomadJob) handleExit(exitInfo ExitInfo, exitInternal <-chan ExitInfo, e
|
||||
func (r *NomadJob) handleContextDone(exitInternal <-chan ExitInfo, exit chan<- ExitInfo,
|
||||
stdin io.ReadWriter, ctx context.Context) {
|
||||
err := ctx.Err()
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
err = ErrorExecutionTimeout
|
||||
} // for errors.Is(err, context.Canceled) the user likely disconnected from the execution.
|
||||
if reason, ok := r.ctx.Value(destroyReasonContextKey).(error); ok {
|
||||
err = reason
|
||||
if r.TimeoutPassed() && !errors.Is(err, ErrorRunnerInactivityTimeout) {
|
||||
|
Reference in New Issue
Block a user