Skip to content

Commit

Permalink
fix: PRT - fix issue with choosing more than one provider when disabl…
Browse files Browse the repository at this point in the history
…ing extensions (lavanet#1429)

* fix issue with choosing more than one provider when disabling extensions

* api not supported error missing
  • Loading branch information
ranlavanet authored May 9, 2024
1 parent 3c06e70 commit 69af1f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion protocol/chainlib/base_chain_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (apip *BaseChainParser) getApiCollection(connectionType, internalPath, addo

// Return an error if spec does not exist
if !ok {
return nil, utils.LavaFormatError("api not supported", nil, utils.Attribute{Key: "connectionType", Value: connectionType})
return nil, utils.LavaFormatWarning("api not supported", common.APINotSupportedError, utils.Attribute{Key: "connectionType", Value: connectionType})
}

// Return an error if api is disabled
Expand Down
8 changes: 4 additions & 4 deletions protocol/lavasession/consumer_session_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ func (csm *ConsumerSessionManager) getSessionWithProviderOrError(usedProviders U
if errGetRegularProvider != nil {
return nil, err // return original error (getValidConsumerSessionsWithProvider)
}
for _, session := range sessionWithProviderMap {
session.RemoveExtensions = true
for key := range sessionWithProviderMap {
sessionWithProviderMap[key].RemoveExtensions = true
}
// print a warning in case we got a provider who does not support that addon or extension.
utils.LavaFormatWarning("No Providers For Addon Or Extension, using regular provider for relay", errOnRetry, utils.LogAttr("addon", addon), utils.LogAttr("extensions", extensionNames))
utils.LavaFormatWarning("No Providers For Addon Or Extension, using regular provider for relay", errOnRetry, utils.LogAttr("addon", addon), utils.LogAttr("extensions", extensionNames), utils.LogAttr("providers_chosen", sessionWithProviderMap))
} else {
return nil, err // return original error (getValidConsumerSessionsWithProvider)
}
Expand Down Expand Up @@ -421,7 +421,7 @@ func (csm *ConsumerSessionManager) GetSessions(ctx context.Context, cuNeededForS
// we can get here if we wanted 3 archive and got 2 only because one couldn't connect,
// so we tried getting more sessions and got a regular provider due to no pairings available.
// in that case just return the current sessions that we do have.
if sessionWithProvider.RemoveExtensions && len(sessions) > 1 {
if sessionWithProvider.RemoveExtensions && len(sessions) >= 1 {
utils.LavaFormatDebug("Too many sessions when using RemoveAddonAndExtensions session", utils.LogAttr("sessions", sessions), utils.LogAttr("wanted_to_add", sessionWithProvider))
// in that case we just return the sessions we already have.
return sessions, nil
Expand Down

0 comments on commit 69af1f2

Please sign in to comment.