Author josh.r
Recipients jiangwanwei, josh.r
Date 2017-03-06.15:48:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488815299.32.0.652157609139.issue29733@psf.upfronthosting.co.za>
In-reply-to
Content
The docs ( https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.as_completed ) do seem to indicate it shouldn't do so as long as results were available before the timeout expired:

"The returned iterator raises a concurrent.futures.TimeoutError if __next__() is called and the result isn’t available after timeout seconds from the original call to as_completed()."

My reading of that would be that it raises the error only when:

1. The timeout has expired
2. The call would block (or possibly, would have blocked after the timeout expired), indicating no result was available

Handling "would have blocked" is hard, but might it make sense to still allow a non-blocking wait on the event even if the timeout has expired, with the exception raised only if the non-blocking wait fails?

Side-note: Looks like this code is still using time.time, not time.monotonic, so it's vulnerable to system clock adjustments; NTP updates could cause a five second timeout to expire instantly, or take seconds or even minutes longer to expire.
History
Date User Action Args
2017-03-06 15:48:19josh.rsetrecipients: + josh.r, jiangwanwei
2017-03-06 15:48:19josh.rsetmessageid: <1488815299.32.0.652157609139.issue29733@psf.upfronthosting.co.za>
2017-03-06 15:48:19josh.rlinkissue29733 messages
2017-03-06 15:48:18josh.rcreate