                  ["--root" "Root directory of web server" :default "public"])]
     (println "port:" (:port options))
     (println "root:" (:root options)))
+
+  (periodically 250 reap-futures)
+
   (while true
     (try
       (run-with-connection)

  (alter-var-root #'*read-eval* (constantly false))


  (let [[options args banner]
        (cli/cli args
                 ["--ampqp-url" "amqp url to connect to"]

        relpath (:relpath (:entry body))
        delivery-tag (:delivery-tag metadata)
        fp (string/join File/separator [directory relpath])
        nack-this-message #(lb/nack ch delivery-tag false false)
        ;; converted (tika/parse fp)
        ]
        ;;
    (register-future
     (future
       (try
         (let [converted (convert fp)]
           ;; (println "before ack" (Thread/currentThread) (:delivery-tag metadata))

           (lb/publish ch
                       exchange
                       (routing-key-string-with-command routing-key "import_file")
                       (json/write-str (assoc body "tika-content" converted)))
           (lb/ack ch delivery-tag))
         (catch Exception err
           (println "got exception while handling" fp err)
           (trace/print-stack-trace err)
           (lb/nack ch delivery-tag false false))))
     {:cleanup-on-error nack-this-message
      :fp fp})


    ;; (println "scheduled" fp " ****" )
    ))

    ;; (println "dir" fp " ****" (:content-type converted))))

