feat: add database connection pooling

This commit is contained in:
Jef Roosens 2023-05-16 09:00:12 +02:00
parent e834b3308a
commit 303e3ffd4e
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 34 additions and 7 deletions

View file

@ -16,7 +16,7 @@ pub async fn register(
};
{
let mut conn = ctx.data().conn.lock().unwrap();
let mut conn = ctx.data().pool.get()?;
user_insert(&mut conn, &user);
}
@ -26,7 +26,7 @@ pub async fn register(
#[poise::command(prefix_command, slash_command)]
pub async fn registered(ctx: Context<'_>) -> Result<(), Error> {
let users = {
let mut conn = ctx.data().conn.lock().unwrap();
let mut conn = ctx.data().pool.get()?;
user_all(&mut conn)
};