;;; +++ Foner.  This file is now obsolete.

(yreq "Utilities/yenta-utils")

(define (time-to-find?)
  (> (current-time) *interests:next-scan*))

(define (find-documents)
  (let ((files (reduce append
		       (map filenames 
			    (append *interests:search-dirs*
				    *interests:own-dirs*)))))
    (scheduler:do ((lst files (cdr lst)))
	((null? lst)
	 (cond ((> *interests:collect-freq* 0)
		(set! *interests:next-scan*
		      (+ *interests:next-scan*
			 *interests:collect-freq*))
		(reschedule))
	       (t
		(set! *interests:next-scan* 0)))
	 (interests:find-interests!))
	(compare:acquire-document *interests:undone* (car lst))
;	(display (car lst))
	)))

(define (reschedule)
  (scheduler:add-once-task! "Document finder" 1 time-to-find? find-documents))

(define (scan-now)
  (when (= 0 *interests:next-scan*)
    (reschedule))
  (set! *interests:next-scan* (current-time)))

(define (scan-then time)
  (when (= 0 *interests:next-scan*)
    (reschedule))
  (set! *interests:next-scan* then))

(define (scan-setup)
  (when (not (= 0 *interests:next-scan*))
    (reschedule)))

;;; End of file.
