File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 44import datetime
55
66from django .db import transaction
7+ from django .db .models .fields .json import KeyTextTransform
78from django .utils import timezone
89from apscheduler .schedulers .background import BackgroundScheduler
910from django_apscheduler .jobstores import DjangoJobStore
1011from application .models import Application , Chat
1112from django .db .models import Q
1213from common .lock .impl .file_lock import FileLock
1314from dataset .models import File
15+ from django .db .models .functions import Cast
16+ from django .db import models
1417
1518scheduler = BackgroundScheduler ()
1619scheduler .add_jobstore (DjangoJobStore (), "default" )
@@ -40,7 +43,7 @@ def clean_chat_log_job():
4043 break
4144 deleted_count , _ = Chat .objects .filter (id__in = logs_to_delete ).delete ()
4245 # 删除对应的文件
43- File .objects .filter (~ Q ( meta__chat_id__in = logs_to_delete ) ).delete ()
46+ File .objects .filter (meta__chat_id__in = [ str ( uuid ) for uuid in logs_to_delete ] ).delete ()
4447 if deleted_count < batch_size :
4548 break
4649
You can’t perform that action at this time.
0 commit comments