-
Notifications
You must be signed in to change notification settings - Fork 17
Spawn wallet actor as a blocking task #2469
Conversation
f48eb9d
to
9c84181
Compare
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.
Happy to try this!
I am currently preferring this solution over comit-network/xtra-productivity#7 since it's easier to verify that everything works correctly. comit-network/xtra-productivity#7 might be helpful in the future if there are actors which have a mix of sync and async actors, but the wallet only has sync handlers, so there the point is moot. |
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.
would you mind adding a bit more info into the commit description? it's a significant find, some context would be great :) thanks!
I just noticed that the |
Sure! |
9c84181
to
d82f32b
Compare
I've realised that this has the side effect of no longer being added to the |
@Restioson it seems clippy complains about some unused import now |
The wallet actor performs a lot of CPU-bound, blocking work in its handlers. This is bad, as it currently runs on the tokio runtime, which explicitly forbids blocking like this. It also does not have any asynchronous handlers, so this commit makes the wallet actor run on a separate thread which blocks on the execution of the actor's future.
d82f32b
to
8b6a57b
Compare
Fixed too :) |
we never documented the purpose of What we had to deal with here is to ensure we drop all the references to some resources (notably the DB) so that we could close it without errors. In wallet case, we don't use the DB, so it should not matter anyway. |
bors r+ |
This is solution 2 to #2453. It spawns the wallet actor as a blocking task. I am not 100% sure if this will correctly make the thread park when nothing is being sent to the wallet actor.