Your problem is probably that there will be too many threads when there are many tasks. To look at this problem differently, use one thread, set it to 5 or 10, and then throw the task into the thread pool. Refer to the usage of python ThreadPoolExecutor.
It is recommended to use multiple processes to try to see if the stuck phenomenon will also occur! Try to find out the cause of the stuck, instead of immediately controlling the number of threads to hide the stuck problem!
pool = threadpool.ThreadPool(poolSize)
poolSize is here to control the number of threads
Your problem is probably that there will be too many threads when there are many tasks. To look at this problem differently, use one thread, set it to 5 or 10, and then throw the task into the thread pool. Refer to the usage of python ThreadPoolExecutor.
It is recommended to use multiple processes to try to see if the stuck phenomenon will also occur!
Try to find out the cause of the stuck, instead of immediately controlling the number of threads to hide the stuck problem!