0

when I try getting the result, it feels like it goes back too not being threaded, but when I don't grab the result. it works like it has 10 threads, any idea why or how I can fix this?

pool = ThreadPoolExecutor(max_workers=10)
    info = pool.submit(check, "Username").result().result
    print(info)

1 Answers1

2

Future.result() blocks until the result is available. If you want several tasks to run concurrently, you need to submit them all before waiting for the results.

pool = ThreadPoolExecutor(max_workers=10)

# Submit tasks
future1 = pool.submit(...)
future2 = pool.submit(...)

# Get task results
result1 = future1.result()
result2 = future2.result()
augurar
  • 12,081
  • 6
  • 50
  • 65