我正在运行多进程,并且在每个任务结束时,我都会用状态更新数据库。
我这样保存
def save(self, *args, **kwargs):
super(ShopPushQueue, self).save(*args, **kwargs)
我仍然遇到以下错误
DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/var/www/venv/local/lib/python2.7/site-
packages/django/db/models/sql/compiler.py", line 894, in execute_sql
raise original_exception
OperationalError: SSL SYSCALL error: EOF detected
我认为该连接不再可用,但我不明白为什么。不使用多重处理时效果很好。
我应该做些什么来刷新数据库连接吗?或维护它
谢谢