style: code format

This commit is contained in:
Lan
2025-02-15 22:00:53 +08:00
parent 7b0ea804cf
commit 10d136b0c5
14 changed files with 404 additions and 311 deletions
+6 -4
View File
@@ -19,13 +19,15 @@ async def delete_expire_files():
while True:
try:
# 遍历 share目录下的所有文件夹,删除空的文件夹,并判断父目录是否为空,如果为空也删除
if settings.file_storage == 'local':
if settings.file_storage == "local":
for root, dirs, files in os.walk(f"{data_root}/share/data"):
if not dirs and not files:
os.rmdir(root)
await ip_limit['error'].remove_expired_ip()
await ip_limit['upload'].remove_expired_ip()
expire_data = await FileCodes.filter(Q(expired_at__lt=await get_now()) | Q(expired_count=0)).all()
await ip_limit["error"].remove_expired_ip()
await ip_limit["upload"].remove_expired_ip()
expire_data = await FileCodes.filter(
Q(expired_at__lt=await get_now()) | Q(expired_count=0)
).all()
for exp in expire_data:
await file_storage.delete_file(exp)
await exp.delete()