From d6ce64c3b6c8c65d34d670de14f28cb46973182b Mon Sep 17 00:00:00 2001 From: youngS Date: Fri, 27 Aug 2021 15:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8B=B9=E6=9E=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E8=80=85=E6=BF=80=E6=B4=BB=E6=A3=80=E6=B5=8B=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/crontab/ctasks.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/fir_ser/api/utils/crontab/ctasks.py b/fir_ser/api/utils/crontab/ctasks.py index f947f49..303913f 100644 --- a/fir_ser/api/utils/crontab/ctasks.py +++ b/fir_ser/api/utils/crontab/ctasks.py @@ -66,13 +66,19 @@ def auto_check_ios_developer_active(): for ios_developer in all_ios_developer: userinfo = ios_developer.user_id if userinfo.supersign_active: - status, result = IosUtils.active_developer(ios_developer) - msg = f"auto_check_ios_developer_active user:{userinfo} ios.developer:{ios_developer} status:{status} result:{result}" - if status: - logger.info(msg) - else: - ios_developer.is_actived = False - ios_developer.save() - logger.error(msg) - send_ios_developer_active_status(userinfo, MSGTEMPLATE.get('AUTO_CHECK_DEVELOPER') % ( - userinfo.first_name, ios_developer.name)) + count = 3 + while count > 0: + status, result = IosUtils.active_developer(ios_developer) + msg = f"auto_check_ios_developer_active user:{userinfo} ios.developer:{ios_developer} status:{status} result:{result}" + if status: + logger.info(msg) + break + else: + count -= 1 + time.sleep(5) + if count == 0: + ios_developer.is_actived = False + ios_developer.save(update_fields=['is_actived']) + logger.error(msg) + send_ios_developer_active_status(userinfo, MSGTEMPLATE.get('AUTO_CHECK_DEVELOPER') % ( + userinfo.first_name, ios_developer.name))