abstract service worker pattern; restart on panic.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
03d890cd49
commit
c111d2e395
8 changed files with 233 additions and 216 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue