perf: 优化 celery 任务中的数据库连接问题

perf: add comment
This commit is contained in:
ibuler
2022-01-17 11:07:27 +08:00
committed by Jiangjie.Bai
parent e1de210585
commit 451e61bb61
2 changed files with 13 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ def get_objects(model, pks):
return objs
# 复制 django.db.close_old_connections, 因为它没有导出ide 提示有问题
def close_old_connections():
for conn in connections.all():
conn.close_if_unusable_or_obsolete()