go-micro icon indicating copy to clipboard operation
go-micro copied to clipboard

Infinite retry

Open liuaiyuan opened this issue 5 years ago • 3 comments

srv

func (u *Users) Read(ctx context.Context, req *pb.ReadRequest, rsp *pb.ReadResponse) error {
       // ...
	return errors.InternalServerError("DATABASE_ERROR", "Error connecting to the database")
}

If an error is returned, it will retry until timeout

liuaiyuan avatar Mar 12 '21 20:03 liuaiyuan

@asim hi

liuaiyuan avatar Apr 05 '21 13:04 liuaiyuan

Go-micro will retry failed request by default, you disable it by setting MICRO_CLIENT_RETRIES=0.

xpunch avatar Apr 06 '21 07:04 xpunch

Go-micro will retry failed request by default, you disable it by setting MICRO_CLIENT_RETRIES=0. hi @xpunch

After testing, it is found that the following two cannot be solved

client.Retries(0)
export MICRO_CLIENT_RETRIES=0

The details of the issue and the PR are here https://github.com/asim/go-micro/issues/2110

We can only solve it by modifying the sendResponse method by ourselves, hoping to fix this bug

liuaiyuan avatar Apr 06 '21 14:04 liuaiyuan