Skip to content

Commit 633ad43

Browse files
committed
chore(agent): Add warning to tell when null allocations are found for senders
1 parent 3326d95 commit 633ad43

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@ impl State {
654654

655655
for row in nonfinal_ravs_sender_allocations_in_db {
656656
// Check if allocation_ids is Some before processing,
657-
// as ARRAY_AGG with FILTER can return NULL
657+
// as ARRAY_AGG with FILTER returns NULL
658+
// instead of an empty array
658659
if let Some(allocation_id_strings) = row.allocation_ids {
659660
let allocation_ids = allocation_id_strings
660661
.iter()
@@ -675,6 +676,12 @@ impl State {
675676
.or_default()
676677
.extend(allocation_ids);
677678
}
679+
} else {
680+
// Log the case when allocation_ids is NULL
681+
tracing::warn!(
682+
sender_address = %row.sender_address,
683+
"Found NULL allocation_ids. This may indicate all RAVs are finalized."
684+
);
678685
}
679686
}
680687
unfinalized_sender_allocations_map
@@ -751,9 +758,10 @@ impl State {
751758

752759
for row in nonfinal_ravs_sender_allocations_in_db {
753760
// Check if allocation_ids is Some before processing,
754-
// as ARRAY_AGG with FILTER can return NULL
761+
// as ARRAY_AGG with FILTER returns NULL instead of an
762+
// empty array
755763
if let Some(allocation_id_strings) = row.allocation_ids {
756-
let allocation_ids = allocation_id_strings // Use the unwrapped Vec<String>
764+
let allocation_ids = allocation_id_strings
757765
.iter()
758766
.map(|allocation_id| {
759767
AllocationId::Legacy(
@@ -772,6 +780,12 @@ impl State {
772780
.or_default()
773781
.extend(allocation_ids);
774782
}
783+
} else {
784+
// Log the case when allocation_ids is NULL
785+
tracing::warn!(
786+
sender_address = %row.sender_address,
787+
"Found NULL allocation_ids. This may indicate all RAVs are finalized."
788+
);
775789
}
776790
}
777791
unfinalized_sender_allocations_map

0 commit comments

Comments
 (0)