mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-03 05:25:24 -04:00
The `SyncService::stop()` method could fail for the following reasons: 1. The supervisor was not properly started up, this is a programmer error. 2. The supervisor task wouldn't shut down and instead it returns a JoinError. 3. We couldn't notify the supervisor task that it should shutdown due the channel being closed. All of those cases shouldn't ever happen and the supervisor task will be stopped in all of them. 1. Since there is no supervisor to be stopped, we can safely just log an error, our tests ensure that a `SyncService::start()` does create a supervisor. 2. A JoinError can be returned if the task has been cancelled or if the supervisor task has panicked. Since we never cancel the task, nor have any panics in the supervisor task, we can assume that this won't happen. 3. The supervisor task holds on to a reference to the receiving end of the channel, as long as the task is alive the channel can not be closed. In conclusion, it doesn't seem to be useful to forward these error cases to the user.