修复清理临时文件失败的问题

dependabot/npm_and_yarn/fir_admin/tmpl-1.0.5
youngS 3 years ago
parent 37df9f4a5d
commit 10297e1616
  1. 4
      fir_ser/api/tasks.py
  2. 2
      fir_ser/api/utils/app/supersignutils.py
  3. 10
      fir_ser/api/utils/crontab/ctasks.py
  4. 2
      fir_ser/api/utils/storage/caches.py
  5. 1
      fir_ser/fir_ser/settings.py

@ -11,7 +11,7 @@ from api.utils.storage.storage import get_local_storage
from api.models import Apps
from api.utils.app.supersignutils import IosUtils, resign_by_app_id
from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_tmp_file, \
from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \
auto_check_ios_developer_active
from api.utils.geetest.geetest_utils import check_bypass_status
@ -74,7 +74,7 @@ def auto_clean_upload_tmp_file_job():
@app.task
def auto_delete_tmp_file_job():
auto_delete_tmp_file()
auto_delete_ios_mobile_tmp_file()
@app.task

@ -170,7 +170,7 @@ def get_auth_form_developer(developer_obj):
"issuer_id": developer_obj.issuer_id,
"private_key_id": developer_obj.private_key_id,
"p8key": developer_obj.p8key,
"certid": developer_obj.certid
"cert_id": developer_obj.certid
}
else:
auth = {}

@ -32,8 +32,8 @@ def auto_clean_upload_tmp_file():
for upload_tem_file_key in cache.iter_keys(key):
data = cache.get(upload_tem_file_key)
if data:
stime = data.get("stime", None)
if stime and time.time() - stime > 60 * 20:
u_time = data.get("u_time", None)
if u_time and time.time() - u_time > 60 * 20:
user_obj = UserInfo.objects.filter(pk=data.get("id")).first()
if user_obj:
storage = Storage(user_obj)
@ -46,9 +46,9 @@ def auto_clean_upload_tmp_file():
logger.info(f"auto_clean_upload_tmp_file upload_tem_file_key :{upload_tem_file_key}")
def auto_delete_tmp_file():
mobileconfig_tmp_dir = os.path.join(SUPER_SIGN_ROOT, 'tmp', 'mobileconfig')
for root, dirs, files in os.walk(mobileconfig_tmp_dir, topdown=False):
def auto_delete_ios_mobile_tmp_file():
mobile_config_tmp_dir = os.path.join(SUPER_SIGN_ROOT, 'tmp', 'mobileconfig')
for root, dirs, files in os.walk(mobile_config_tmp_dir, topdown=False):
now_time = time.time()
for name in files:
file_path = os.path.join(root, name)

@ -231,7 +231,7 @@ def upload_file_tmp_name(act, filename, user_obj_id):
tmp_key = "_".join([CACHE_KEY_TEMPLATE.get("upload_file_tmp_name_key"), filename])
if act == "set":
cache.delete(tmp_key)
cache.set(tmp_key, {'time': time.time(), 'id': user_obj_id, "filename": filename}, 60 * 60)
cache.set(tmp_key, {'u_time': time.time(), 'id': user_obj_id, "filename": filename}, 2 * 60 * 60)
elif act == "get":
return cache.get(tmp_key)
elif act == "del":

@ -222,7 +222,6 @@ SYNC_CACHE_TO_DATABASE = {
'try_login_times': (10, 12 * 60 * 60), # 当天登录失败次数,超过该失败次数,锁定24小时
'auto_clean_tmp_file_times': 60 * 30, # 定时清理上传失误生成的临时文件
'auto_clean_local_tmp_file_times': 60 * 30, # 定时清理临时文件,现在包含超级签名描述临时文件
'auto_clean_apscheduler_log': 100000, # 定时清理定时任务执行的日志,该日志存在数据库中,该参数为日志保留的数量
'try_send_msg_over_limit_times': (3, 60 * 60), # 每小时用户发送信息次数
'clean_local_tmp_file_from_mtime': 60 * 60, # 清理最后一次修改时间超过限制时间的临时文件,单位秒
'auto_check_ios_developer_active_times': 60 * 60 * 12, # ios开发者证书检测时间

Loading…
Cancel
Save