aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm23
-rw-r--r--sqitch/deploy/dates_to_load_new_guix_revision_jobs.sql12
-rw-r--r--sqitch/revert/dates_to_load_new_guix_revision_jobs.sql8
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/dates_to_load_new_guix_revision_jobs.sql8
5 files changed, 44 insertions, 8 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 58dc121..2ae372d 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -385,13 +385,15 @@
(simple-format
#t "Successfully loaded ~A package/derivation pairs\n"
- (length package-derivation-ids))))
+ (length package-derivation-ids)))
+ #t)
(lambda (key . args)
(simple-format (current-error-port)
"Failed extracting information: ~A ~A\n"
key args)
(force-output)
- (exec-query conn "ROLLBACK")))))
+ (exec-query conn "ROLLBACK")
+ #f))))
(define (load-new-guix-revision conn git-repository-id commit)
(if (guix-revision-exists? conn git-repository-id commit)
@@ -440,6 +442,14 @@ RETURNING id;")
(list (number->string n)))))
result))
+(define (record-job-succeeded conn id)
+ (exec-query
+ conn
+ (string-append
+ "UPDATE load_new_guix_revision_jobs WHERE id = $1 "
+ "SET succeeded_at = current_time")
+ (list id)))
+
(define (process-next-load-new-guix-revision-job conn)
(let ((next
(exec-query
@@ -452,10 +462,7 @@ RETURNING id;")
(begin
(simple-format #t "Processing job ~A (commit: ~A, source: ~A)\n\n"
id commit source)
- (load-new-guix-revision conn git-repository-id commit)
- (exec-query
- conn
- (string-append "DELETE FROM load_new_guix_revision_jobs WHERE id = '"
- id
- "'"))))
+ (when (eq? (load-new-guix-revision conn git-repository-id commit)
+ #t)
+ (record-job-succeeded conn id))))
(_ #f))))
diff --git a/sqitch/deploy/dates_to_load_new_guix_revision_jobs.sql b/sqitch/deploy/dates_to_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..989c4e5
--- /dev/null
+++ b/sqitch/deploy/dates_to_load_new_guix_revision_jobs.sql
@@ -0,0 +1,12 @@
+-- Deploy guix-data-service:dates_to_load_new_guix_revision_jobs to pg
+-- requires: initial_import
+
+BEGIN;
+
+ALTER TABLE load_new_guix_revision_jobs
+ ADD COLUMN created_at timestamp without time zone DEFAULT clock_timestamp();
+
+ALTER TABLE load_new_guix_revision_jobs
+ ADD COLUMN succeeded_at timestamp without time zone;
+
+COMMIT;
diff --git a/sqitch/revert/dates_to_load_new_guix_revision_jobs.sql b/sqitch/revert/dates_to_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..614b37f
--- /dev/null
+++ b/sqitch/revert/dates_to_load_new_guix_revision_jobs.sql
@@ -0,0 +1,8 @@
+-- Revert guix-data-service:dates_to_load_new_guix_revision_jobs from pg
+
+BEGIN;
+
+ALTER TABLE load_new_guix_revision_jobs DROP COLUMN created_at;
+ALTER TABLE load_new_guix_revision_jobs DROP COLUMN succeeded_at;
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index c8a7529..b4c873d 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -11,3 +11,4 @@ remove_package_metadata_sha1_hash 2019-05-12T10:37:40Z Christopher Baines <mail@
add_location_information 2019-05-12T20:27:48Z Christopher Baines <mail@cbaines.net> # Add locations table and location to package_metadata
add_git_repositories_cgit_url_base 2019-05-13T18:45:14Z Christopher Baines <mail@cbaines.net> # Add cgit_url_base to git_repositories
license_support 2019-05-13T20:37:40Z Christopher Baines <mail@cbaines.net> # Add support for storing license information
+dates_to_load_new_guix_revision_jobs 2019-06-02T07:39:49Z Christopher Baines <mail@cbaines.net> # Add dates to the load_new_guix_revision_jobs table
diff --git a/sqitch/verify/dates_to_load_new_guix_revision_jobs.sql b/sqitch/verify/dates_to_load_new_guix_revision_jobs.sql
new file mode 100644
index 0000000..71afed2
--- /dev/null
+++ b/sqitch/verify/dates_to_load_new_guix_revision_jobs.sql
@@ -0,0 +1,8 @@
+-- Verify guix-data-service:dates_to_load_new_guix_revision_jobs on pg
+
+BEGIN;
+
+SELECT created_at FROM load_new_guix_revision_jobs WHERE FALSE;
+SELECT succeeded_at FROM load_new_guix_revision_jobs WHERE FALSE;
+
+ROLLBACK;