   (try
     (clog/disable-logging!)
     (set-inspecting-on!)
-    (process-metrics tenant rollups paths cass-hosts
-                     (pstore/elasticsearch-path-store es-url options) options
-                     list-metrics-processor)
+    (cp/with-shutdown! [tpool (get-thread-pool options)]
+      (process-metrics tenant rollups paths cass-hosts
+                       (pstore/elasticsearch-path-store es-url options) options
+                       list-metrics-processor tpool))
     (catch Exception e
       (clog/unhandled-error e))))
 
 (defn- process-paths
   "Process paths."
-  [tenant paths pstore options processor-fn & [tpool]]
-  (let [tpool (get-thread-pool options tpool)
-        processor (processor-fn pstore tenant options)
+  [tenant paths pstore options processor-fn tpool]
+  (let [processor (processor-fn pstore tenant options)
         title (pp-get-title processor)]
     (try
       (prog/set-progress-bar!

      (log/info starting-str)
      (log-cli-cmd options)
      (dry-mode-warn options)
      (process-paths tenant paths
                     (pstore/elasticsearch-path-store es-url options)
                     options remove-paths-processor))
    (catch Exception e
      (clog/unhandled-error e))))


      (log/info starting-str)
      (log-cli-cmd options)
      (dry-mode-warn options)
      (cp/with-shutdown! [tpool (get-thread-pool options)]
        (let [pstore (pstore/elasticsearch-path-store es-url options)
              sort (get-sort-or-dummy-fn (:sort options))
              empty-paths (->> (tree-walker tenant paths pstore options
                                            empty-paths-finder tpool)
                               (sort))]
          (process-paths tenant empty-paths pstore options
                         remove-empty-paths-processor tpool))))
    (catch Exception e
      (clog/unhandled-error e))))

