server/state: add spawn_internal_task and use it for websockets

is a helper to spawn an internal tokio task without it showing up
in the task list

it is still tracked for reload and notifies the last_worker_listeners

this enables the console to survive a reload of proxmox-backup-proxy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-07-23 15:20:13 +02:00
committed by Thomas Lamprecht
parent 224c65f8de
commit 33a88dafb9
2 changed files with 31 additions and 9 deletions

View File

@ -267,7 +267,7 @@ fn upgrade_to_websocket(
let (ws, response) = WebSocket::new(parts.headers)?;
tokio::spawn(async move {
crate::server::spawn_internal_task(async move {
let conn: Upgraded = match req_body.on_upgrade().map_err(Error::from).await {
Ok(upgraded) => upgraded,
_ => bail!("error"),