perf: 账号备份日志优化 (#11151)

Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
fit2bot
2023-08-01 18:17:02 +08:00
committed by GitHub
parent 8ed823d587
commit d182d14e26
2 changed files with 27 additions and 36 deletions

View File

@@ -4,13 +4,9 @@ import time
from django.utils import timezone
from common.utils import get_logger
from common.utils.timezone import local_now_display
from .handlers import AccountBackupHandler
logger = get_logger(__name__)
class AccountBackupManager:
def __init__(self, execution):
@@ -23,7 +19,7 @@ class AccountBackupManager:
def do_run(self):
execution = self.execution
logger.info('\n\033[33m# 账号备份计划正在执行\033[0m')
print('\n\033[33m# 账号备份计划正在执行\033[0m')
handler = AccountBackupHandler(execution)
handler.run()
@@ -35,10 +31,10 @@ class AccountBackupManager:
self.time_end = time.time()
self.date_end = timezone.now()
logger.info('\n\n' + '-' * 80)
logger.info('计划执行结束 {}\n'.format(local_now_display()))
print('\n\n' + '-' * 80)
print('计划执行结束 {}\n'.format(local_now_display()))
self.timedelta = self.time_end - self.time_start
logger.info('用时: {}s'.format(self.timedelta))
print('用时: {}s'.format(self.timedelta))
self.execution.timedelta = self.timedelta
self.execution.save()