mirror of
https://gitlab.com/schmiddi-on-mobile/flare.git
synced 2026-10-29 15:07:47 -04:00
If the backend is busy, e.g. downloading attachments, this would block the entire backend thread as it cannot handle multiple commands at the same time (it will directly await on executing the first command, and only afterwards handle the second one). Fixing this problem is very difficult as the presage::Manager cannot be sent between threads. One therefore needs to use tokio::task::LocalSet for the fix, which runs the futures on the current tokio thread. This still leads to problems though as many functions in the manager require mutable (and therefore exclusive) access to the manager. There is no good way to fix it except for wrapping the manager in a RwLock (I have chosen to use one from tokio, as using the one in std would likely lead to clippy issues with hold locks accross await points). This is only a partial fix though, if some method requires mutable access to the manager, this still blocks every other method from executing. But it should at least fix the most serious contenders, like downloading attachments. I don't know a better fix at this time. Potentially related to #271.