Add sql transactions

This commit is contained in:
Tobias Reisinger 2024-05-02 13:30:24 +02:00
parent f4fbc95500
commit 4489b37a3f
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
3 changed files with 39 additions and 42 deletions

View file

@ -86,9 +86,10 @@ impl Handler<Reload> for AppState {
fn handle(&mut self, _msg: Reload, _ctx: &mut Self::Context) -> Self::Result {
log::debug!("Reloading controller");
let mut pool_conn = block_on(self.pool.acquire())?;
let mut tx = block_on(self.pool.begin())?;
self.this.reload(&mut pool_conn)?;
self.this.reload(&mut tx)?;
block_on(tx.commit())?;
self.notify_controller_change();