Skip to content

Commit

Permalink
Merge pull request #98 from freifunk-saar/transaction
Browse files Browse the repository at this point in the history
fix some DB interactions not being transactions any more
  • Loading branch information
RalfJung authored Jan 1, 2024
2 parents f00b02a + 9730853 commit cf6fd41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Action {
let op = self.op;
let node = self.node.clone();
let email = self.email.clone();
db.run(move |db| {
db.run_transaction(move |db| {
let m = Monitor {
id: node.as_str(),
email: &email,
Expand Down
2 changes: 1 addition & 1 deletion src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async fn list(email: EmailAddress, ctx: Ctx<'_>, db: DbConn) -> Result<Template>
use crate::schema::*;

let vars = db
.run::<_, anyhow::Result<_>>(move |db| {
.run_transaction(move |db| {
let watched_nodes = monitors::table
.filter(monitors::email.eq(&*email))
.left_join(nodes::table.on(monitors::id.eq(nodes::id)))
Expand Down

0 comments on commit cf6fd41

Please sign in to comment.