Reconnect if the database connection has been lost.
This commit is contained in:
parent
440efb7cf9
commit
46458f11aa
|
@ -105,6 +105,7 @@
|
|||
(defgeneric set-ipv4 (store domain name ip))
|
||||
(defgeneric set-ipv6 (store domain name ip))
|
||||
(defgeneric set-sshfp (store domain name sshfp))
|
||||
(defgeneric ensure-connection (store))
|
||||
|
||||
(defmethod set-ipv4 ((store postgres-dns-store)
|
||||
(domain string)
|
||||
|
@ -140,3 +141,9 @@
|
|||
(sshfps list))
|
||||
(if-let ((new-sshfps (mapcar #'sshfp-p sshfps)))
|
||||
(replace-records domain name "SSHFP" new-sshfps)))
|
||||
|
||||
(defmethod ensure-connection ((store postgres-dns-store))
|
||||
(let ((db postmodern:*database*))
|
||||
(when (not (connected-p conn))
|
||||
(reconnect conn))
|
||||
store))
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
(handler-case
|
||||
(if-let ((store *dns-store*))
|
||||
(-> message
|
||||
(ensure-connection store)
|
||||
(handle-dns-message store)
|
||||
(handle-dns-response (msg-id message)))
|
||||
(make-error :msg "dns store is not initialized"
|
||||
|
|
Loading…
Reference in New Issue