Do DB rollback on failed build insert
This commit is contained in:
parent
7b5119189d
commit
265e00a718
1 changed files with 8 additions and 1 deletions
|
@ -223,4 +223,11 @@ let add_build
|
||||||
Db.commit () >>= fun () ->
|
Db.commit () >>= fun () ->
|
||||||
commit_files basedir staging_dir job_name uuid
|
commit_files basedir staging_dir job_name uuid
|
||||||
in
|
in
|
||||||
or_cleanup r
|
Lwt_result.bind_lwt_err (or_cleanup r)
|
||||||
|
(fun e ->
|
||||||
|
Db.rollback ()
|
||||||
|
|> Lwt.map (fun r ->
|
||||||
|
Result.iter_error
|
||||||
|
(fun e' -> Log.err (fun m -> m "Failed rollback: %a" Caqti_error.pp e'))
|
||||||
|
r;
|
||||||
|
e))
|
||||||
|
|
Loading…
Reference in a new issue