abstract async shutdown waiting loop

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-29 02:21:22 +00:00 committed by strawberry
parent 0a9b6c136f
commit 9eb99f8070
2 changed files with 13 additions and 8 deletions

View file

@ -97,13 +97,8 @@ pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result {
);
// Server shutdown
let server_shutdown = async move {
while self.services.server.running() {
self.services.server.signal.subscribe().recv().await.ok();
}
};
futures.push(server_shutdown.boxed());
let server_shutdown = self.services.server.clone().until_shutdown().boxed();
futures.push(server_shutdown);
if !self.services.server.running() {
return Ok(());
}