Answer the question
In order to leave comments, you need to log in
How to interact with the database with multithreading?
Hello! I have a python worker that takes data from the database and then starts a thread with a loader. Initially, the status in the database is "in the queue", after the worker has picked up the status it becomes "in work", then the download goes in a separate thread, after the download is completed the status should be "ready", here is the problem, an error occurs
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
2013, "Lost connection"
Answer the question
In order to leave comments, you need to log in
About the essence of the error is written here https://habrahabr.ru/post/21326/ or here www.mysql.ru/docs/man/Commands_out_of_sync.html
It is not clear how your database access class is implemented. But if all the workers go through one common connection, then the links indicate what is happening. For good, each worker should open its own connection to the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question