        (update :payload #(s/validate nodes/configure-expiration-wireformat-schema %))
        (update-in [:payload :producer_timestamp] #(or % (now))))))
 
-(defn exec-configure-expiration [{:keys [id received payload]} start-time db]
+(defn exec-configure-expiration [{:keys [id received payload]} start-time db conn-status]
   (let [{:keys [certname producer_timestamp]} payload
         expire-facts? (get-in payload [:expire :facts])]
     (when-not (nil? expire-facts?)
-      (jdbc/with-transacted-connection db
-        (scf-storage/maybe-activate-node! certname producer_timestamp)
-        (scf-storage/set-certname-facts-expiration certname expire-facts? producer_timestamp))
+      (jdbc/retry-with-monitored-connection
+       db conn-status :read-committed
+       (fn []
+         (scf-storage/maybe-activate-node! certname producer_timestamp)
+         (scf-storage/set-certname-facts-expiration certname expire-facts? producer_timestamp)))
       (log-command-processed-messsage id received start-time
                                       :configure-expiration certname))))
 


;; FIXME: was to-timestamp redundant here and in store-report? others don't have it...

(defn exec-deactivate-node [{:keys [id received payload]} start-time db]
  (let [{:keys [certname producer_timestamp]} payload]
    (jdbc/with-transacted-connection db
      (when-not (scf-storage/certname-exists? certname)
        (scf-storage/add-certname! certname))
      (scf-storage/deactivate-node! certname producer_timestamp))
    (log-command-processed-messsage id received start-time :deactivate-node certname)))

;; Report submission

   (assoc command :payload (cat/parse-catalog payload version received))))

(defn exec-replace-catalog
  [{:keys [version id received payload]} start-time db conn-status]
  (let [{producer-timestamp :producer_timestamp certname :certname :as catalog} payload]
    (jdbc/retry-with-monitored-connection
     db conn-status :repeatable-read
     (fn []
       (scf-storage/maybe-activate-node! certname producer-timestamp)
       (scf-storage/replace-catalog! catalog received)))
    (log-command-processed-messsage id received start-time :replace-catalog certname)))

;; Catalog input replacement
