Skip to content

Commit

Permalink
Merge branch 'v-3-0-1-near-hf' into v3-1-0-near-hf
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Sep 3, 2024
2 parents 200972c + 80f4a4b commit 9a0d9ba
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions protocol/rpcconsumer/rpcconsumer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,21 @@ func (rpccs *RPCConsumerServer) ProcessRelaySend(ctx context.Context, protocolMe
if rpccs.debugRelays {
utils.LavaFormatDebug("Relay initiated with the following timeout schedule", utils.LogAttr("processingTimeout", processingTimeout), utils.LogAttr("newRelayTimeout", relayTimeout))
}

apiName := protocolMessage.GetApi().Name
resetUsedOnce := true
setArchiveOnSpecialApi := func() {
if apiName == "tx" || apiName == "chunk" || apiName == "EXPERIMENTAL_tx_status" {
archiveExtensionArray := []string{"archive"}
protocolMessage.OverrideExtensions(archiveExtensionArray, rpccs.chainParser.ExtensionsParser())
protocolMessage.RelayPrivateData().Extensions = archiveExtensionArray
if resetUsedOnce {
resetUsedOnce = false
relayProcessor.usedProviders = lavasession.NewUsedProviders(protocolMessage)
}
}
}

// create the processing timeout prior to entering the method so it wont reset every time
processingCtx, processingCtxCancel := context.WithTimeout(ctx, processingTimeout)
defer processingCtxCancel()
Expand All @@ -456,6 +471,7 @@ func (rpccs *RPCConsumerServer) ProcessRelaySend(ctx context.Context, protocolMe
if relayProcessor.HasRequiredNodeResults() {
gotResults <- true
} else {
setArchiveOnSpecialApi()
gotResults <- false
}
}
Expand Down Expand Up @@ -504,6 +520,7 @@ func (rpccs *RPCConsumerServer) ProcessRelaySend(ctx context.Context, protocolMe
case <-startNewBatchTicker.C:
// only trigger another batch for non BestResult relays or if we didn't pass the retry limit.
if relayProcessor.ShouldRetry(numberOfRetriesLaunched) {
setArchiveOnSpecialApi()
// limit the number of retries called from the new batch ticker flow.
// if we pass the limit we just wait for the relays we sent to return.
err := rpccs.sendRelayToProvider(processingCtx, protocolMessage, relayProcessor, nil)
Expand Down

0 comments on commit 9a0d9ba

Please sign in to comment.