abstract service worker pattern; restart on panic.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk committed 2024-07-14 11:31:39 +00:00
1 parent 03d890cd49
commit c111d2e395
8 files changed
+233 -216

No files matched your search

+4 -2
View File
@@ -42,10 +42,12 @@ pub async fn init(server: &Arc<Server>) -> Result<()> {
let s = Box::new(Services::build(server.clone(), d)?);
_ = SERVICES.write().expect("write locked").insert(Box::leak(s));
Ok(())
services().start().await
}
pub fn fini() {
pub async fn fini() {
services().stop().await;
// Deactivate services(). Any further use will panic the caller.
let s = SERVICES
.write()