Skip to content

Commit

Permalink
Use better names for worker tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Dec 15, 2021
1 parent b0ec483 commit 490b8df
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion relayer/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn spawn_worker_tasks<ChainA: ChainHandle + 'static, ChainB: ChainHandle + '
);
task_handles.push(packet_task);

let link_task = packet::spawn_link_worker(path.clone(), link);
let link_task = packet::spawn_packet_worker(path.clone(), link);
task_handles.push(link_task);
}
}
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/worker/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn spawn_channel_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandle +
let mut resume_handshake = true;

spawn_background_task(
"channel_worker".to_string(),
format!("ChannelWorker({})", channel.short_name()),
Some(Duration::from_millis(200)),
move || {
if let Ok(cmd) = cmd_rx.try_recv() {
Expand Down
4 changes: 2 additions & 2 deletions relayer/src/worker/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn spawn_refresh_client<ChainA: ChainHandle + 'static, ChainB: ChainHandle +
mut client: ForeignClient<ChainA, ChainB>,
) -> TaskHandle {
spawn_background_task(
"refresh_client".to_string(),
format!("RefreshClientWorker({})", client),
Some(Duration::from_secs(1)),
move || -> Result<(), TaskError<ForeignClientError>> {
let res = client.refresh().map_err(|e| {
Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn detect_misbehavior_task<ChainA: ChainHandle + 'static, ChainB: ChainHandl
}

let handle = spawn_background_task(
"detect_misbehavior".to_string(),
format!("DetectMisbehaviorWorker({})", client),
Some(Duration::from_millis(600)),
move || -> Result<(), TaskError<TryRecvError>> {
if let Ok(cmd) = receiver.try_recv() {
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/worker/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn spawn_connection_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandl
let mut resume_handshake = true;

spawn_background_task(
"connection_worker".to_string(),
format!("ConnectionWorker({})", connection.short_name()),
Some(Duration::from_millis(200)),
move || {
if let Ok(cmd) = cmd_rx.try_recv() {
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/worker/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define_error! {
Retry
{ retries: retry::Error<u64> }
| e | {
format_args!("Packet worker failed after {} retries",
format_args!("Worker failed after {} retries",
e.retries)
},

Expand Down
6 changes: 3 additions & 3 deletions relayer/src/worker/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn spawn_packet_cmd_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandl
) -> TaskHandle {
let mut is_first_run: bool = true;
spawn_background_task(
"packet_worker".to_string(),
format!("PacketCmdWorker({})", link.a_to_b),
Some(Duration::from_millis(200)),
move || {
if let Ok(cmd) = cmd_rx.try_recv() {
Expand All @@ -65,12 +65,12 @@ pub fn spawn_packet_cmd_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandl
)
}

pub fn spawn_link_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandle + 'static>(
pub fn spawn_packet_worker<ChainA: ChainHandle + 'static, ChainB: ChainHandle + 'static>(
path: Packet,
link: Arc<Link<ChainA, ChainB>>,
) -> TaskHandle {
spawn_background_task(
"link_worker".to_string(),
format!("PacketWorker({})", link.a_to_b),
Some(Duration::from_millis(500)),
move || {
link.a_to_b
Expand Down

0 comments on commit 490b8df

Please sign in to comment.