-
Notifications
You must be signed in to change notification settings - Fork 29
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
Mark unrecoverable errors so they don't spawn #412
Conversation
Mark unrecoverable sender errors in storage so that they no longer spawn isolates. Spawning isolates and failing them immediately uses more resources than necessary. This is therefore a performance improvement for the stability of the app. In the medium term we should switch on errors from payjoin-flutter, but those errors are not yet available to switch on. This will reduce the amount of error definition and handling we have to manually implement, but since this is a potential immediate performance issue I'm addressing it straight away.
1cf3a0b
to
fd2fc86
Compare
This way they don't respawn if they're never going to succeed.
lib/_pkg/payjoin/manager.dart
Outdated
@@ -281,6 +301,9 @@ class PayjoinManager { | |||
|
|||
return completer.future; | |||
} catch (e) { | |||
if (e is UnrecoverableError) { |
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.
@DanGould I think this never gets here and should be moved to the receive port listener where the UnrecoverableError
is send to from the isolate. So I guess instead of the message is Err
on line 283, check for and handle the UnrecoverableError
there.
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.
I made this change as well as one where if errors in the switch statement crop up we mark the receiver payjoin session as unrecoverable which I detail in the commit message. Let me know what you think.
Receivers need to handle both switch errors or isolate errors. This change takes the error handling out of the spawn try-catch, which would never receive them and moves it into places where those errors would propagate. Note that some of the switch errors like checkIsOwned might crop up because of a wallet being improperly loaded, but for the time being we don't have the granularity to distinguish between them.
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.
LGTM!
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 works now 👍
Thanks @DanGould! Thanks @kumulynja and @bitcoin-b for the review! |
Mark unrecoverable errors in storage so that they no longer spawn isolates.
Spawning isolates and failing them immediately uses more resources than necessary. This is therefore a performance improvement for the stability of the app.
In the medium term we should switch on errors from payjoin-flutter, but those errors are not yet available to switch on. This will reduce the amount of error definition and handling we have to manually implement, but since this is a potential immediate performance issue I'm addressing it straight away.