From a7cef081761fe95ecc3611710d35734b20208fba Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 22 Jan 2020 14:00:26 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=B0=83=E5=BA=A6=E5=8F=AF=E8=83=BD=E4=B8=A2=E5=A4=B1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/schedule/executors.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spug_api/apps/schedule/executors.py b/spug_api/apps/schedule/executors.py index 1d08ad9..6e4efaa 100644 --- a/spug_api/apps/schedule/executors.py +++ b/spug_api/apps/schedule/executors.py @@ -6,6 +6,7 @@ from threading import Thread from libs.ssh import SSH from apps.host.models import Host from apps.setting.utils import AppSetting +from django.db import close_old_connections import subprocess import time @@ -30,6 +31,7 @@ def host_executor(q, host, pkey, command): def dispatch(command, targets): + close_old_connections() threads, pkey, q = [], AppSetting.get('private_key'), Queue() for t in targets: if t == 'local':