Skip to content

Commit

Permalink
add: improve multihttpprovider log
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Dec 16, 2024
1 parent 4342aa2 commit 4956b54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/wallet/MultipleHttpProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ export class MultipleHttpProvider extends HttpProvider {
return await this._sendRequest(payload)
} catch (exception) {
const error = exception?.error ? JSON.stringify(exception?.error) : exception?.message
const notTxError = !isTxError(error)

// log error to analytics if last peer failed, ie all rpcs failed
if (!isTxError(error) && !loggedProviders.has(provider) && peers[peers.length - 1] === item) {
if (notTxError && !loggedProviders.has(provider) && peers[peers.length - 1] === item) {
loggedProviders.set(provider, true)

const { message: originalMessage } = exception
Expand All @@ -68,7 +69,7 @@ export class MultipleHttpProvider extends HttpProvider {
log.warn('MultiHttpProvider rate limit error', exception.message, exception, { provider })
endpoints.splice(endpoints.indexOf(item, 1))
setTimeout(() => endpoints.push(item), 60000)
} else {
} else if (notTxError) {
log.warn('MultiHttpProvider failed to send:', exception.message, exception, { error, provider })
}

Expand Down

0 comments on commit 4956b54

Please sign in to comment.