 (defn auto-deactivate-nodes!
   "Deactivate nodes which haven't had any activity (catalog/fact submission)
   for more than `node-ttl`."
-  [db node-ttl]
+  [node-ttl db]
   {:pre [(map? db)
          (period? node-ttl)]}
   (try


(defn sweep-reports!
  "Delete reports which are older than than `report-ttl`."
  [db report-ttl]
  {:pre [(map? db)
         (period? report-ttl)]}
  (try


      ;; Pretty much this helper just knows our job-pool and gc-interval
      (let [gc-interval-millis (to-millis gc-interval)
            gc-task (fn [f] (apply interspaced gc-interval-millis f job-pool))
            db-maintenance-tasks [garbage-collect!
                                  (when (pos? (to-secs node-ttl))
                                    (partial auto-deactivate-nodes! node-ttl))
                                  (when (pos? (to-secs node-purge-ttl))
                                    (partial purge-nodes! node-purge-ttl))
                                  (when (pos? (to-secs report-ttl))
                                    (partial sweep-reports! report-ttl))]]

        (gc-task #(apply perform-db-maintenance! db (remove nil? db-maintenance-tasks)))
        (gc-task #(compress-dlo! dlo-compression-threshold discard-dir )))

      ;; Start debug REPL if necessary
      (let [{:keys [enabled type host port] :or {type "nrepl" host "localhost"}} (:repl config)]
