Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qfix] Use cloned nse in retry registry #1207

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkg/registry/common/retry/nse_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *retryNSEClient) Register(ctx context.Context, nse *registry.NetworkServ

for ctx.Err() == nil {
registerCtx, cancel := c.WithTimeout(ctx, r.tryTimeout)
resp, err := next.NetworkServiceEndpointRegistryClient(registerCtx).Register(registerCtx, nse, opts...)
resp, err := next.NetworkServiceEndpointRegistryClient(registerCtx).Register(registerCtx, nse.Clone(), opts...)
cancel()

if err != nil {
Expand All @@ -81,8 +81,12 @@ func (r *retryNSEClient) Find(ctx context.Context, query *registry.NetworkServic
logger := log.FromContext(ctx).WithField("retryNSEClient", "Find")
c := clock.FromContext(ctx)

cloneQuery := query
if query != nil {
cloneQuery.NetworkServiceEndpoint = query.NetworkServiceEndpoint.Clone()
}
for ctx.Err() == nil {
stream, err := next.NetworkServiceEndpointRegistryClient(ctx).Find(ctx, query, opts...)
stream, err := next.NetworkServiceEndpointRegistryClient(ctx).Find(ctx, cloneQuery, opts...)

if err != nil {
logger.Errorf("try attempt has failed: %v", err.Error())
Expand All @@ -102,7 +106,7 @@ func (r *retryNSEClient) Unregister(ctx context.Context, in *registry.NetworkSer

for ctx.Err() == nil {
closeCtx, cancel := c.WithTimeout(ctx, r.tryTimeout)
resp, err := next.NetworkServiceEndpointRegistryClient(closeCtx).Unregister(closeCtx, in, opts...)
resp, err := next.NetworkServiceEndpointRegistryClient(closeCtx).Unregister(closeCtx, in.Clone(), opts...)
cancel()

if err != nil {
Expand Down