Support inserting build statuses without a transaction
In case this code is run as part of a bigger transaction.
This commit is contained in:
parent
8d6f255646
commit
cbe9859064
1 changed files with 11 additions and 7 deletions
|
|
@ -58,7 +58,8 @@ WHERE builds.build_server_id = $1 AND
|
||||||
(list build-id)
|
(list build-id)
|
||||||
`((,timestamp ,status))))
|
`((,timestamp ,status))))
|
||||||
|
|
||||||
(define (insert-build-statuses conn build-ids data)
|
(define* (insert-build-statuses conn build-ids data
|
||||||
|
#:key (transaction? #t))
|
||||||
(define query
|
(define query
|
||||||
(string-append
|
(string-append
|
||||||
"
|
"
|
||||||
|
|
@ -130,10 +131,13 @@ WINDOW rows_for_build AS (
|
||||||
|
|
||||||
(exec-query conn query))
|
(exec-query conn query))
|
||||||
|
|
||||||
(with-postgresql-transaction
|
(define (operations conn)
|
||||||
conn
|
(exec-query conn query '())
|
||||||
(lambda (conn)
|
|
||||||
(exec-query conn query '())
|
|
||||||
|
|
||||||
(delete-old-latest-status-entries conn)
|
(delete-old-latest-status-entries conn)
|
||||||
(insert-new-latest-status-entries conn))))
|
(insert-new-latest-status-entries conn))
|
||||||
|
|
||||||
|
(if transaction?
|
||||||
|
(with-postgresql-transaction conn
|
||||||
|
operations)
|
||||||
|
(operations conn)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue