Skip to content

Commit c191935

Browse files
committed
fix: return gRPC code "unavailable" if server is not initialized yet
Correct error code helps client to decide when it should retry request. Signed-off-by: Konstantin Khlebnikov <[email protected]>
1 parent 93e3a50 commit c191935

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/cri/instrument/instrumented_service.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package instrument
1818

1919
import (
2020
"context"
21-
"errors"
2221

2322
"github.com/containerd/containerd/v2/errdefs"
2423
"github.com/containerd/containerd/v2/tracing"
@@ -63,7 +62,7 @@ func (in *instrumentedService) checkInitialized() error {
6362
if in.c.IsInitialized() {
6463
return nil
6564
}
66-
return errors.New("server is not initialized yet")
65+
return errdefs.ToGRPCf(errdefs.ErrUnavailable, "server is not initialized yet")
6766
}
6867

6968
func (in *instrumentedService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (res *runtime.RunPodSandboxResponse, err error) {

0 commit comments

Comments
 (0)