refactor: Return error from context (#140)

This commit is contained in:
Mikhail Mazurskiy 2020-09-19 03:50:06 +10:00 committed by GitHub
parent c04f859da9
commit 8d05efd2df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,6 @@ package engine
import (
"context"
"errors"
"fmt"
"io"
"time"
@ -113,7 +112,7 @@ func (e *gitOpsEngine) Sync(ctx context.Context,
select {
case <-ctx.Done():
syncCtx.Terminate()
return resources, errors.New("sync operation was terminated")
return resources, ctx.Err()
case <-time.After(operationRefreshTimeout):
case <-resUpdated:
}