fixes login locking up after refresh

This commit is contained in:
Aiden McClelland
2022-04-11 19:45:25 -06:00
committed by Aiden McClelland
parent 0d96007c2f
commit 50f14fe040
3 changed files with 25 additions and 7 deletions

View File

@@ -47,7 +47,7 @@
{
"name": "id: u32",
"ordinal": 0,
"type_info": "Null"
"type_info": "Int64"
}
],
"parameters": {
@@ -68,6 +68,16 @@
"nullable": []
}
},
"2932aa02735b6422fca4ba889abfb3de8598178d4690076dc278898753d9df62": {
"query": "UPDATE session SET logged_out = CURRENT_TIMESTAMP WHERE id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
}
},
"3502e58f2ab48fb4566d21c920c096f81acfa3ff0d02f970626a4dcd67bac71d": {
"query": "SELECT tor_key FROM account",
"describe": {

View File

@@ -148,6 +148,10 @@ async fn deal_with_messages(
}
return Ok(())
}
None => {
tracing::info!("Closing WebSocket: Stream Finished");
return Ok(())
}
_ => (),
}
}

View File

@@ -39,12 +39,16 @@ impl HasLoggedOutSessions {
.by_ref()
.map(|x| x.as_logout_session_id())
.collect::<Vec<_>>();
sqlx::query(&format!(
"UPDATE session SET logged_out = CURRENT_TIMESTAMP WHERE id IN ('{}')",
sessions.join("','")
))
.execute(&mut ctx.secret_store.acquire().await?)
.await?;
let mut sqlx_conn = ctx.secret_store.acquire().await?;
for session in &sessions {
sqlx::query!(
"UPDATE session SET logged_out = CURRENT_TIMESTAMP WHERE id = ?",
session
)
.execute(&mut sqlx_conn)
.await?;
}
drop(sqlx_conn);
for session in sessions {
for socket in ctx
.open_authed_websockets