Reconnect if the database connection has been lost.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user