python - Individual timeouts for concurrent.futures -


i see 2 ways specify timeouts in concurrent.futures.

  • as_completed()
  • wait()

both methods handle n running futures.

i specify individual timeout each future.

use case:

  • future getting data db has timeout of 0.5 secs.
  • future getting data http server has timeout of 1.2 secs.

how handle concurrent.futures? or library not right tool?

conclusion

how implementing own:

wait(dbfutures + httpfutures, timeout=0.5) [fut.cancel() fut in bdfutures if not fut.done()] wait(httpfutures, timeout=0.7) [fut.cancel() fut in httpfutures if not fut.done()] 

(or while loop sleep/check or wait short timeout)


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -