feat: make database access more uniform and stop locking as many pool connections
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

This commit is contained in:
Radical 2025-07-21 04:15:04 +02:00
parent f5d4211fad
commit fa52412b43
30 changed files with 516 additions and 373 deletions

View file

@ -71,9 +71,9 @@ pub async fn ws(
// Authorize client using auth header
let uuid = check_access_token(auth_header, &mut conn).await?;
global_checks(&app_state, uuid).await?;
global_checks(&mut conn, &app_state.config, uuid).await?;
let channel = Channel::fetch_one(&app_state, channel_uuid).await?;
let channel = Channel::fetch_one(&mut conn, &app_state.cache_pool, channel_uuid).await?;
Member::check_membership(&mut conn, uuid, channel.guild_uuid).await?;
@ -103,7 +103,8 @@ pub async fn ws(
let message = channel
.new_message(
&app_state,
&mut conn,
&app_state.cache_pool,
uuid,
message_body.message,
message_body.reply_to,