From 4a9d45aa16b9584d8d955cb72daf6315515e3e62 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 21 Feb 2022 13:02:57 +0000 Subject: [PATCH] Skip dropping the log part sequence if there's a lock So that the job completes. The sequence can be deleted later. --- .../jobs/load-new-guix-revision.scm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index d8f49ca..9456562 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -300,11 +300,22 @@ WHERE job_id = $1") (list job-id))))) (define (drop-log-parts-sequence conn job-id) - (exec-query + (with-postgresql-transaction conn - (string-append - "DROP SEQUENCE IF EXISTS " - (log-part-sequence-name job-id)))) + (lambda (conn) + (exec-query conn + "SET LOCAL lock_timeout = '10s'") + (with-exception-handler + (lambda (exn) + (simple-format (current-error-port) + "error when dropping sequence: ~A" + exn)) + (lambda () + (exec-query conn + (string-append + "DROP SEQUENCE IF EXISTS " + (log-part-sequence-name job-id)))) + #:unwind? #t)))) (define (vacuum-log-parts-table conn) (exec-query