         (dotimes [i n-threads]
           (go
             (loop []
+              (>! logger (scheduler-stats))
               (if-let [job-ref (scheduler-take! 600000 nil)]
                 ;; normal batches won't be nil
                 ;; only get nil when channel is closed


(defn- scheduler-retry! [& args] (apply dq/retry! args))


(defn run [& {:keys [db index-revision-number index-id skip-create-snapshot]
              :or {db (d/db datomic-conn)

                    (recur)))
                (close! logger)))))

        (run-index-all db)
        ;;(run-index-sample db)
        (prn (scheduler-stats))

        )

      (if-not skip-create-snapshot
