Skip to content

Commit 3a70fa2

Browse files
authored
fix(tap-agent): handle manager error (#192)
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent d3eafbe commit 3a70fa2

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

tap-agent/src/agent/sender_account.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,16 @@ impl Actor for SenderAccount {
495495
SenderAccountMessage::UpdateAllocationIds(allocation_ids) => {
496496
// Create new sender allocations
497497
for allocation_id in allocation_ids.difference(&state.allocation_ids) {
498-
state
498+
if let Err(error) = state
499499
.create_sender_allocation(myself.clone(), *allocation_id)
500-
.await?;
500+
.await
501+
{
502+
error!(
503+
%error,
504+
%allocation_id,
505+
"There was an error while creating Sender Allocation."
506+
);
507+
}
501508
}
502509

503510
// Remove sender allocations
@@ -627,9 +634,16 @@ impl Actor for SenderAccount {
627634
return Ok(());
628635
};
629636

630-
state
637+
if let Err(error) = state
631638
.create_sender_allocation(myself.clone(), allocation_id)
632-
.await?;
639+
.await
640+
{
641+
error!(
642+
%error,
643+
%allocation_id,
644+
"Error while recreating Sender Allocation."
645+
);
646+
}
633647
}
634648
_ => {}
635649
}

tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,16 @@ impl Actor for SenderAccountsManager {
190190
SenderAccountsManagerMessage::UpdateSenderAccounts(target_senders) => {
191191
// Create new sender accounts
192192
for sender in target_senders.difference(&state.sender_ids) {
193-
state
193+
if let Err(e) = state
194194
.create_sender_account(myself.get_cell(), *sender, HashSet::new())
195-
.await?;
195+
.await
196+
{
197+
error!(
198+
sender_address = %sender,
199+
error = %e,
200+
"There was an error while creating a sender account."
201+
);
202+
}
196203
}
197204

198205
// Remove sender accounts
@@ -255,9 +262,16 @@ impl Actor for SenderAccountsManager {
255262
.remove(&sender_id)
256263
.unwrap_or(HashSet::new());
257264

258-
state
265+
if let Err(e) = state
259266
.create_sender_account(myself.get_cell(), sender_id, allocations)
260-
.await?;
267+
.await
268+
{
269+
error!(
270+
error = %e,
271+
sender_address = %sender_id,
272+
"There was an error while re-creating sender account."
273+
);
274+
}
261275
}
262276
_ => {}
263277
}

0 commit comments

Comments
 (0)