-
Notifications
You must be signed in to change notification settings - Fork 53
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
Ability to configure several RPC (failover) urls #28
Comments
We are using the RPC URLs in two ways: as HTTP endpoints (for sending raw txs) and for creating web3 instances. The HTTP endpoints part is not hard: we should have a function that receives a list of URLs and a callback, tries the callback in each URL and either returns the result or retries. (There are several details to be taken into account here, but they are not that important.) The web3 part is what concerns me. I can think of several options here:
I think the 2nd option is a good one, but it would take some time to develop and test. If that's not a possibility, I guess the 1st option could work. |
Thanks @fvictorio for the summary. |
We are sending raw HTTP for sending the transactions, since that way it's easier to send multiple transactions with consecutive nonces. I will work on the provider approach then, thanks! |
Is it possible to use https://web3js.readthedocs.io/en/1.0/web3-eth.html#sendsignedtransaction |
I already have something working that does the fallback both when using HTTP and with web3 (they are separate implementations). There are some pending things to do, but after they are done I will create the PR with that. But doing everything through web3 sounds cleaner and easier to maintain, so let's keep that option open and maybe we can do refactor so that everything goes through web3 (that can be done in that PR or in a future one). |
@akolotov I forgot to follow up on this: we can't use web3 for raw transactions because the promise resolves when the transaction is mined, while we just wait for the transaction to be received. Maybe we could do something around this: wait until all txs are mined (but this would mean that the time to mark the job as finished would increase a lot) or check if we can use the event emitter of the response (instead of the promise) to finish when the transaction is received. |
@fvictorio let's continue the discussion in #61. I would prefer the second approach - without usage of the promise. |
…al-rpc-failover-urls Support several RPC URLs
At this moment it is possible to configure on one RPC URL for each bridge direction:
It means that if the remote node will not be accessible (e.g. the link is down or the node was shut down) the bridge will not be able to get events and send transactions by using the corresponding RPC channel.
In order to increase the availability of the bridge operations it is suggested to introduce the ability to configure a list of RPC URLs:
In this case, the bridge should switch to the next RPC link in the list if the previous URL in the list is not accessible. As soon as the link is switched the corresponding log message should appear, e.g.
If only one RPC link is configured the bridge should use a random delay (e.g. from 5 to 30 seconds) to try to reconnect to the RPC link.
If the end of the list is reached the first URL from the list must be checked again and the bridge should switch to this channel.
If all channels are not available the bridge should use a random delay (e.g. from 5 to 30 seconds) to try to reconnect to the first RPC link from the list.
The text was updated successfully, but these errors were encountered: