gRPC

gRPC 0 OK vs 1 CANCELLED

Both gRPC 0 (OK) and 1 (CANCELLED) belong to the gRPC Status Codes category. 0 indicates that the operation completed successfully. Not an error; returned on success. Meanwhile, 1 means that the operation was cancelled, typically by the caller.

0 OK
gRPC

คำอธิบาย

The operation completed successfully. Not an error; returned on success.

เมื่อคุณพบเห็น

The RPC completed without any issues. This is the expected response for every successful gRPC call.

วิธีแก้ไข

No fix needed — this indicates everything worked correctly.

คำอธิบาย

The operation was cancelled, typically by the caller.

เมื่อคุณพบเห็น

The client explicitly cancelled the RPC, or a deadline or context cancellation propagated to the server before it could finish processing.

วิธีแก้ไข

If unexpected, check whether the client is setting too-short deadlines or if cancellation is being triggered inadvertently in your call chain.

ความแตกต่างหลัก

1.

gRPC 0: The operation completed successfully. Not an error; returned on success.

2.

gRPC 1: The operation was cancelled, typically by the caller.

3.

You encounter 0 when the RPC completed without any issues. This is the expected response for every successful gRPC call.

4.

You encounter 1 when the client explicitly cancelled the RPC, or a deadline or context cancellation propagated to the server before it could finish processing.

ควรใช้อันไหนเมื่อไร

For 0 (OK): No fix needed — this indicates everything worked correctly. For 1 (CANCELLED): If unexpected, check whether the client is setting too-short deadlines or if cancellation is being triggered inadvertently in your call chain.

เรียนรู้เพิ่มเติม