perf: 修复 Count 时没有去重的问题

This commit is contained in:
Bai
2024-01-18 19:43:55 +08:00
committed by 老广
parent 37a0d831da
commit dc79346bdc
10 changed files with 17 additions and 15 deletions

View File

@@ -55,7 +55,7 @@ def clean_historical_accounts():
history_model = Account.history.model
history_id_mapper = defaultdict(list)
ids = history_model.objects.values('id').annotate(count=Count('id')) \
ids = history_model.objects.values('id').annotate(count=Count('id', distinct=True)) \
.filter(count__gte=limit).values_list('id', flat=True)
if not ids: