-
Notifications
You must be signed in to change notification settings - Fork 42
add payment failed info: attempts and retries interval #502
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
Conversation
|
""" WalkthroughThe logic for handling payment failure notifications was updated. Now, when a payment fails for the first time, a Changes
Sequence Diagram(s)sequenceDiagram
participant System
participant Notifier
System->>System: Payment fails
alt First failure
System->>Notifier: Send PaymentFailed (with retry config)
else Not first failure and attempts >= limit
System->>Notifier: Send AddInvoice (with order payload)
else Intermediate failure
Note right of System: No notification sent
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
It must be tested with mostro core of the pr MostroP2P/mostro-core#111 |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/app/release.rs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/app/release.rs (1)
src/util.rs (1)
enqueue_order_msg(850-865)
🪛 GitHub Actions: Rust
src/app/release.rs
[error] 52-52: cannot find struct, variant or union type PaymentFailedInfo in this scope
[error] 61-61: no variant or associated item named PaymentFailed found for enum mostro_core::message::Payload in the current scope
🔇 Additional comments (4)
src/app/release.rs (4)
42-42: Good addition for tracking first failure.The
is_first_failurevariable correctly identifies when to send the initial failure notification with retry details.
53-53: Good use ofsaturating_subfor remaining attempts calculation.Using
saturating_sub(1)correctly calculates remaining attempts while preventing underflow, providing accurate information to the user about how many retries they have left.
49-76: Verify the notification logic aligns with PR objectives.The updated logic correctly implements the PR requirements:
- First failure: Sends
PaymentFailedmessage with retry details- Retry limit reached: Sends
AddInvoicemessage- Intermediate failures: No notifications (reduces spam)
However, ensure this behavior change doesn't break existing client expectations.
Search for other places in the codebase that might expect the old behavior:
#!/bin/bash # Description: Find other references to PaymentFailed action handling # Expected: Identify potential areas that need updates echo "Searching for PaymentFailed action handling..." rg -A 5 -B 5 "Action::PaymentFailed\|PaymentFailed.*Action" echo "Searching for payment failure related message handling..." rg -A 10 "check_failure_retries"
61-61: ```shell
#!/bin/bashSearch for the 'Payload' enum definition and its variants
echo "Locating definition of enum Payload..."
rg -n "enum Payload" || trueecho -e "\nShowing 20 lines of context around enum Payload..."
rg -n "enum Payload" -A20 || trueecho -e "\nSearching for any occurrences of 'PaymentFailed' across the repo..."
rg -n "PaymentFailed" || true</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
fix #474
Now, when an invoice payment fails:
Summary by CodeRabbit