-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot fix updating order on fiat-sent #423
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe pull request modifies the Changes
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/app/fiat_sent.rs (2)
63-69
: Enhance error logging for better debugging.While the error handling is good, the error details are being discarded in the
Err(_)
pattern. Consider logging the actual error message to help with debugging production issues.- let mut order_updated = match update_order_event(my_keys, Status::FiatSent, &order).await { - Ok(order) => order.update(pool).await?, - Err(_) => { - error!("Can't update order {}!", order.id); - return Ok(()); - } - }; + let mut order_updated = match update_order_event(my_keys, Status::FiatSent, &order).await { + Ok(order) => order.update(pool).await?, + Err(e) => { + error!("Failed to update order {}: {}", order.id, e); + return Ok(()); + } + };
105-109
: Consider handling database update errors explicitly.The final
update(pool).await?
propagates errors up the call stack, which might lead to an incomplete operation if the update fails. Consider handling this error explicitly to ensure proper cleanup or logging.if order_updated.creator_pubkey == event.rumor.pubkey.to_string() && next_trade.is_some() { if let Some((pubkey, index)) = next_trade { order_updated.next_trade_pubkey = Some(pubkey.clone()); order_updated.next_trade_index = Some(index as i64); - order_updated.update(pool).await?; + if let Err(e) = order_updated.update(pool).await { + error!("Failed to update next trade fields for order {}: {}", order_updated.id, e); + return Ok(()); + } } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/app/fiat_sent.rs
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: tests
🔇 Additional comments (2)
src/app/fiat_sent.rs (2)
71-76
: LGTM! Good error handling.The seller pubkey validation is well-handled with appropriate error logging.
83-83
: LGTM! Consistent use of updated order state.Good practice using
order_updated.id
consistently throughout the message sending logic.Also applies to: 95-95
Handling database update errors explicitly
Summary by CodeRabbit