Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
  • Loading branch information
pperiyasamy committed Jul 29, 2021
1 parent 0465995 commit c8ba354
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/networkservice/common/resourcepool/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (i *resourcePoolClient) Request(ctx context.Context, request *networkservic
logger := log.FromContext(ctx).WithField("resourcePoolClient", "Request")

oldPCIAddress := request.GetConnection().GetMechanism().GetParameters()[common.PCIAddressKey]
oldTokenIDKey := request.GetConnection().GetMechanism().GetParameters()[TokenIDKey]
oldTokenID := request.GetConnection().GetMechanism().GetParameters()[TokenIDKey]

conn, err := next.Client(ctx).Request(ctx, request, opts...)
if err != nil {
Expand All @@ -81,7 +81,7 @@ func (i *resourcePoolClient) Request(ctx context.Context, request *networkservic
}

// Don't make second request if PCI address, token id weren't changed
if conn.GetMechanism().GetParameters()[common.PCIAddressKey] == oldPCIAddress && oldTokenIDKey == tokenID {
if conn.GetMechanism().GetParameters()[common.PCIAddressKey] == oldPCIAddress && oldTokenID == tokenID {
return conn, nil
}

Expand All @@ -92,9 +92,6 @@ func (i *resourcePoolClient) Request(ctx context.Context, request *networkservic
if conn, err = next.Client(ctx).Request(ctx, request); err != nil {
// Perform local cleanup in case of second Request failed
_ = i.resourcePool.close(request.Connection)
if _, closeErr := next.Client(ctx).Close(ctx, conn, opts...); closeErr != nil {
logger.Errorf("failed to close failed connection: %s %s", conn.GetId(), closeErr.Error())
}
}

return conn, nil
Expand Down

0 comments on commit c8ba354

Please sign in to comment.