i'm bad and it's 4am
This commit is contained in:
parent
bd63237c17
commit
1c9c029768
10
webcrawler
10
webcrawler
|
@ -125,7 +125,7 @@
|
|||
(define worker-ready (make-vector NUM-TASKS #t))
|
||||
(define pending (mutable-set root-url))
|
||||
(define completed (mutable-set))
|
||||
(define flags (mutable-set))
|
||||
(define all-flags (mutable-set))
|
||||
(let loop ()
|
||||
(define any-busy (for/or ([r (in-vector worker-ready)]) (not r)))
|
||||
(unless (and (not any-busy) (set-empty? pending))
|
||||
|
@ -148,16 +148,16 @@
|
|||
(for ([u (in-list new-urls)])
|
||||
(unless (set-member? completed u)
|
||||
(set-add! pending u)))
|
||||
(for ([flag (in-list flags)] #:when (not (set-member? flags flag)))
|
||||
(for ([flag (in-list flags)] #:when (not (set-member? all-flags flag)))
|
||||
(print-flag flag)
|
||||
(set-add! flags flag)))
|
||||
(set-add! all-flags flag)))
|
||||
|
||||
(print-progress (+ (set-count completed) (set-count pending))
|
||||
(for/sum ([v (in-vector worker-ready)] #:when (not v)) 1)
|
||||
(set-count completed) (set-count flags))
|
||||
(set-count completed) (set-count all-flags))
|
||||
|
||||
(loop)))
|
||||
(print-complete (set-count completed) (set-count flags))
|
||||
(print-complete (set-count completed) (set-count all-flags))
|
||||
;; send all workers the shutdown message and wait
|
||||
(for ([thd (in-vector worker-threads)])
|
||||
(thread-send thd #f)
|
||||
|
|
Loading…
Reference in New Issue