perf: 删除发布机执行的任务目录

pull/11622/head
Eric 2023-09-19 14:13:16 +08:00 committed by Eric_Lee
parent 68c4cd5928
commit 19c76ba01c
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import datetime import datetime
import os import os
import shutil
import yaml import yaml
from django.conf import settings from django.conf import settings
@ -116,6 +117,11 @@ class DeployAppletHostManager:
) )
return runner.run(**kwargs) return runner.run(**kwargs)
def delete_runtime_dir(self):
if settings.DEBUG_DEV:
return
shutil.rmtree(self.run_dir)
def _run(self, cb_func: callable, **kwargs): def _run(self, cb_func: callable, **kwargs):
try: try:
self.deployment.date_start = timezone.now() self.deployment.date_start = timezone.now()
@ -128,3 +134,4 @@ class DeployAppletHostManager:
self.deployment.date_finished = timezone.now() self.deployment.date_finished = timezone.now()
with safe_db_connection(): with safe_db_connection():
self.deployment.save() self.deployment.save()
self.delete_runtime_dir()