Skip to content

Commit

Permalink
A bit mor tracing to further investigate the problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Feb 19, 2025
1 parent 571d088 commit e5b068c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions core/payment/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,15 @@ impl PaymentProcessor {
let payments: Vec<Payment> = {
let db_executor = self.db_executor.timeout_lock(DB_LOCK_TIMEOUT).await?;

log::trace!("get_batch_order_items_by_payment_id {}...", msg.payment_id);
let order_items = db_executor
.as_dao::<BatchDao>()
.get_batch_order_items_by_payment_id(msg.payment_id, payer_id)
.await?;
log::trace!("get_batch_order_items_by_payment_id finished and received {} items", order_items.len());

for order_item in order_items.iter() {
log::trace!("Getting documents for order item: {:?}", order_item);
let order_documents = match db_executor
.as_dao::<BatchDao>()
.get_batch_items(
Expand All @@ -808,6 +811,7 @@ impl PaymentProcessor {
)));
}
};
log::trace!("Set orders paid: {:?}", order_item);

db_executor
.as_dao::<BatchDao>()
Expand All @@ -819,6 +823,8 @@ impl PaymentProcessor {
)
.await?;
for order in order_documents.iter() {
log::trace!("Find activity for order: {:?}", order);

//get agreement by id
let agreement = db_executor
.as_dao::<AgreementDao>()
Expand Down Expand Up @@ -863,6 +869,8 @@ impl PaymentProcessor {
}
}

log::trace!("Summing up notifications for peers: {:?}", peers_to_sent_to.values());

// Sum up the amounts for each peer
for (key, value) in peers_to_sent_to.iter_mut() {
for val in &value.activity_payments {
Expand Down Expand Up @@ -907,10 +915,13 @@ impl PaymentProcessor {
value.agreement_payments = agreement_map.into_values().collect();
}

log::trace!("Signing {} payments...", peers_to_sent_to.len());

let mut payloads = Vec::new();
for (key, value) in peers_to_sent_to.iter() {
let payment_dao: PaymentDao = db_executor.as_dao();

log::trace!("Creating new payment for peer: {}", value.payee_id);
payment_dao
.create_new(
value.payment_id.clone(),
Expand All @@ -926,12 +937,14 @@ impl PaymentProcessor {
)
.await?;

log::trace!("Get signed payment for peer: {}", value.payee_id);
let signed_payment = payment_dao
.get(payment_id.clone(), payer_id)
.await?
.unwrap();
payloads.push(signed_payment.payload);
}
log::trace!("Part of processing blocking DB done, releasing DB");
payloads
};

Expand Down
2 changes: 1 addition & 1 deletion core/serv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl ServiceCommand {
env::set_var(
"RUST_LOG",
env::var("RUST_LOG").unwrap_or("info".to_string())
+ ",ya_payment::timeout_lock=trace",
+ ",ya_payment::timeout_lock=trace,ya_payment::processor=trace",
);
}

Expand Down

0 comments on commit e5b068c

Please sign in to comment.