Hermes: Conditionally spawn the relayer worker only if there are outstanding packets #901
Closed
3 of 8 tasks
Labels
A: good-first-issue
Admin: good for newcomers
I: CLI
Internal: related to the relayer's CLI
I: logic
Internal: related to the relaying logic
O: new-feature
Objective: cause to add a new feature or support
O: performance
Objective: cause to improve performance
Milestone
Crate
relayer
Summary
We should optimize the starting of a worker for a
UnidirectionalChannelPath
, so that the worker only get spawned if there is any outstanding packets to relay (e.g., unreceived packets or unreceived acks).Problem Definition
Currently, within the
multi-start
command, the workers forUnidirectionalChannelPath
get spawned as soon as Hermes detects an open channel. This worker, however, might not have any job to do if there are no outstanding packets to relay.https://github.com/informalsystems/ibc-rs/blob/13f592b8a4db47356a057470949c41361391564a/relayer/src/supervisor.rs#L231-L238
Proposal
Prior to spawning the worker for
UnidirectionalChannelPath
, we should detect if there are unreceived packets (or acks). To detect this, we can reuse functionality from query CLIsUnreceivedPackets
(andUnreceivedAcks
), see . The query CLI implementation, however, spawns its own runtimes and consequently it is awkward to reuse it.Acceptance Criteria
We should probably proceed as follows:
UnreceivedPackets
andUnreceivedAcks
. Ideally, we should encapsulate the logic for detecting outstanding packets in some methods, and reuse those methods both from the CLI queries and frommulti-start
command.multi-start
command, in the supervisor to conditionally spawn a worker forUnidirectionalChannelPath
only if there are outstanding packets to relay.start
commandFor Admin Use
The text was updated successfully, but these errors were encountered: