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-ipv4 (store domain name ip))
|
||||||
(defgeneric set-ipv6 (store domain name ip))
|
(defgeneric set-ipv6 (store domain name ip))
|
||||||
(defgeneric set-sshfp (store domain name sshfp))
|
(defgeneric set-sshfp (store domain name sshfp))
|
||||||
|
(defgeneric ensure-connection (store))
|
||||||
|
|
||||||
(defmethod set-ipv4 ((store postgres-dns-store)
|
(defmethod set-ipv4 ((store postgres-dns-store)
|
||||||
(domain string)
|
(domain string)
|
||||||
@ -140,3 +141,9 @@
|
|||||||
(sshfps list))
|
(sshfps list))
|
||||||
(if-let ((new-sshfps (mapcar #'sshfp-p sshfps)))
|
(if-let ((new-sshfps (mapcar #'sshfp-p sshfps)))
|
||||||
(replace-records domain name "SSHFP" new-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
|
(handler-case
|
||||||
(if-let ((store *dns-store*))
|
(if-let ((store *dns-store*))
|
||||||
(-> message
|
(-> message
|
||||||
|
(ensure-connection store)
|
||||||
(handle-dns-message store)
|
(handle-dns-message store)
|
||||||
(handle-dns-response (msg-id message)))
|
(handle-dns-response (msg-id message)))
|
||||||
(make-error :msg "dns store is not initialized"
|
(make-error :msg "dns store is not initialized"
|
||||||
|
Loading…
Reference in New Issue
Block a user