Reputation: 432
I am using Flask Sqlalchemy and have given mysql as job store while initiating the Scheduler. But Sometimes when I add job to scheduler it throws 'Mysql Server has gone away' error probably client has disconnected..Can anyone suggest if we can handle this using some event listeners and reconnect to the database..
Upvotes: 2
Views: 811
Reputation: 1383
MySQL closes it self the stale connections (8 hours of inactivity by default). You can set the pool recycle
to solve this problem.
app.config["SQLALCHEMY_POOL_RECYCLE"] = 300
Upvotes: 1