diff options
author | Christopher Baines <mail@cbaines.net> | 2020-04-24 09:00:20 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-24 09:00:20 +0100 |
commit | a0263a0eae3940eb83aea78845d4714d84db7426 (patch) | |
tree | f9f65c136c9abfd757e51ef6f74519c4e270c753 /scripts | |
parent | 0cc78b90aec0ccdd8740092a465753cc71bca704 (diff) | |
download | data-service-a0263a0eae3940eb83aea78845d4714d84db7426.tar data-service-a0263a0eae3940eb83aea78845d4714d84db7426.tar.gz |
Set a statement timeout of 60 seconds for web requests
This will help stop queries running for an unnecessarily long time, longer
than NGinx will wait for example.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/guix-data-service.in | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index a09a204..70274d0 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -82,8 +82,13 @@ (lambda (opt name arg result) (alist-cons 'host arg - (alist-delete 'host result)))))) - + (alist-delete 'host result)))) + (option '("postgresql-statement-timeout") #t #f + (lambda (opt name arg result) + (alist-cons 'postgresql-statement-timeout + (string->number arg) + (alist-delete 'postgresql-statement-timeout + result)))))) (define %default-options ;; Alist of default option values @@ -97,7 +102,9 @@ ("" #f) (_ #t))) (port . 8765) - (host . "0.0.0.0"))) + (host . "0.0.0.0") + (postgresql-statement-timeout . 60000))) + (define (parse-options args) (args-fold @@ -187,6 +194,9 @@ (assq-ref opts 'host) (assq-ref opts 'port)) - (start-guix-data-service-web-server (assq-ref opts 'port) - (assq-ref opts 'host) - (assq-ref opts 'secret-key-base)))) + (start-guix-data-service-web-server + (assq-ref opts 'port) + (assq-ref opts 'host) + (assq-ref opts 'secret-key-base) + #:postgresql-statement-timeout + (assq-ref opts 'postgresql-statement-timeout)))) |