     #_(log/trace "checking pending files")
     (doseq [file @pending-files]
       (try (when (stable? file)
-             (dosync (alter pending-files disj file))
-             (when (.exists file)
-               (add-file folder file)
-               (process-file folder file)))
+             (add-file folder file))
+           (when (or (stable? file) (not (.exists file)))
+             (dosync (alter pending-files disj file)))
            (catch Exception e (log/error e "adding pending file" (str file)))))))
 
 (defn add-pending-file


(defn stable?
  "Returns true if the file has has content and has not been modified
  for at least thirty seconds."
  [file]
  (and (pos? (.length file))
       (< (.lastModified file) (- (System/currentTimeMillis) stable-time))))

(defn add-subtitles
  "Performs the initial scan for subtitles."
  [folder video]
  (doseq [file (.listFiles (:file folder) (subtitle-filter (:title video)))]
    (log/info "adding subtitles" (str file))
    (add-subtitle folder file video)))

(defn add-images

      (add-images folder video))))

(defn add-file
  "Adds a newly discovered file to the library and queues it for
  processing."
  [folder file]
  (log/info "adding file" (str file))
  (when-let [video (video-for-file folder file)]
