-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Automated retries #1776
base: master
Are you sure you want to change the base?
Automated retries #1776
Conversation
eb65eb5
to
7c875d1
Compare
7c875d1
to
c0157fc
Compare
8757074
to
09cb758
Compare
@@ -53,5 +53,5 @@ export default function useInvoice () { | |||
return newInvoice | |||
}, [retryPaidAction]) | |||
|
|||
return { cancel, retry, isInvoice } | |||
return useMemo(() => ({ cancel, retry, isInvoice }), [cancel, retry, isInvoice]) |
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.
This useMemo
and the one in useSendWallets
is pretty important since it avoids that waitForWalletPayment
changes between renders which would mean that we run the useEffect
for retries with the same failed invoices multiple times.
In general, this means it is very important that waitForWalletPayment
is stable across renders.
<RetryHandler> | ||
{children} | ||
</RetryHandler> |
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.
RetryHandler
isn't a context provider, but I think we should use more providers inside context providers nonetheless. There are too many in pages/_app.js.
For example, we could put all providers for the carousel (price, block height, chain fee) into the same component.
f79f837
to
ccbde0d
Compare
ccbde0d
to
15c799d
Compare
Description
close #1492 based on #1785, #1787
All failed invoices are returned only once to exactly one client via a new query
failedInvoices
. To avoid an invoice being returned but never retried by a client for any reason, a visibility timeout as described in #1492 (comment) is used: for each returned invoice, we set a newInvoice.lockedAt
column to the current time and then unset it when we can assume that the client did not and will not attempt a retry of this invoice.To stop after three payment attempts (= two retries), a new integer column
Invoice.paymentAttempt
tracks at which payment attempt we are. This number is increased when we retry an invoice that has been locked. This is only the case when we start a new payment attempt. If we retry the first invoice of a payment attempt, it is not locked and thus the new invoice will have the same number in itspaymentAttempt
column. This means payment attempts are isolated from each other by giving each invoice of the same payment attempt the same value in theirpaymentAttempt
column. But this also means that if a payment attempt is interrupted after the first invoice was retried, we cannot continue it but will increase the counter. I think that's okay.TODO:
added
userCancel
column, see #1785client only polls when it has send wallets
added
"cancelledAt" < now() - interval '${WALLET_RETRY_AFTER_MS} milliseconds'
filteradded
WALLET_RETRY_BEFORE_MS
used in this filter:Additional Context
Checklist
Are your changes backwards compatible? Please answer below:
tbd
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
7
. Tested automated retries for posting and comment with this patch:To decrease time between retries, use this patch:
Tested automated retries for p2p zaps with this patch that makes forwards fail and disables the fallback to CCs:
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a
Did you introduce any new environment variables? If so, call them out explicitly here:
no