Answer the question
In order to leave comments, you need to log in
How to close mysql connection in a looped script?
I am using RabbitMQ. It has workers where there are different queries to the database. And I have connections to the database, tk. they are not closed (the script does not end, but waits for new messages).
Question: what are the correct ways to close the connection?
I see:
1. Or manually register closing the connection after saving the message.
2. Or do not close (but it eats a lot of resources)
3. Or there is something else.
Answer the question
In order to leave comments, you need to log in
So maybe you don’t need to open a connection every time you receive a task, then they won’t accumulate?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question