-
Notifications
You must be signed in to change notification settings - Fork 44
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
improve(relayer): Support dynamic handover in production #1781
Conversation
The fast relayer can presently have multiple concurrent instances for a short period of time because there is no method of coordinating the "active" relayer. This can cause some collisions when both relayer instances attempt to fill the same transaction(s), and requires that the relayer be stopped via a SIGHUP, which is slightly awkward in the serverless environment. This change instead uses redis as a coordination mechanism between relayer instances, such that a new relayer will update a specific redis record when it is ready to take over from any previous instance. Likewise, and existing instance will detect when the record is updated and will gracefully exit thereafter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to make this more generic for any/all bots? Or do we just want to implement this now for the fast relayer
The relayer in looping mode is currently the only bot that's really suited for this, because it has a natural recurring point to check for handover. The other bots don't yet have this so it's not really clear for me how they'd benefit from it...but in a world where they are more event-based (i.e. precomputing executions and waiting for the right block to execute them) then I think this could be pretty beneficial and would definitely be worth generalising. |
The fast relayer can presently have multiple concurrent instances for a short period of time because there is no method of coordinating the "active" relayer. This can cause some collisions when both relayer instances attempt to fill the same transaction(s), and requires that the relayer be stopped via a SIGHUP, which is slightly awkward in the serverless environment.
This change instead uses redis as a coordination mechanism between relayer instances, such that a new relayer will update a specific redis record when it is ready to take over from any previous instance. Likewise, and existing instance will detect when the record is updated and will gracefully exit thereafter.