diff options
| author | Ryan Williams <breath@alum.mit.edu> | 2010-06-19 18:42:30 -0700 |
|---|---|---|
| committer | Ryan Williams <breath@alum.mit.edu> | 2010-06-19 18:42:30 -0700 |
| commit | bf3944b0e19185cc38ab76e14da4bb89868c82be (patch) | |
| tree | a54d13bcdda2e294e45849c6ff8d108d8967d055 /examples | |
| parent | 392682b8fa2fd2bdd9c5bd5b6ec84cae5ef5526f (diff) | |
| download | eventlet-bf3944b0e19185cc38ab76e14da4bb89868c82be.tar.gz | |
Tweaked the implementation of Timeout so that passing True as the exception class is the same as passing None, because it seemed inconsistent that one boolean value would have special nice behavior and the other would cause weird exceptions.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/producer_consumer.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/producer_consumer.py b/examples/producer_consumer.py index b335f7d..6f6c82f 100644 --- a/examples/producer_consumer.py +++ b/examples/producer_consumer.py @@ -2,7 +2,7 @@ it doesn't respect robots.txt and it is pretty brutal about how quickly it fetches pages. -This is a kind of "producer/consumer" example; the producer function produces +This is a kind of "producer/consumer" example; the fetch function produces jobs, and the GreenPool itself is the consumer, farming out work concurrently. It's easier to write it this way rather than writing a standard consumer loop; GreenPool handles any exceptions raised and arranges so that there's a set @@ -43,10 +43,10 @@ def producer(start_url): # limit requests to eventlet.net so we don't crash all over the internet if url not in seen and 'eventlet.net' in url: seen.add(url) - pool.spawn(fetch, url, q) + pool.spawn_n(fetch, url, q) return seen seen = producer("http://eventlet.net") print "I saw these urls:" -print "\n".join(seen)
\ No newline at end of file +print "\n".join(seen) |
