perf: 优化账号版本计算策略 (#12547)

Co-authored-by: feng <1304903146@qq.com>
pull/12549/head
fit2bot 2024-01-16 11:33:21 +08:00 committed by GitHub
parent fabee37e9e
commit e29e51121d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,8 @@ def on_account_pre_save(sender, instance, **kwargs):
if instance.version == 0:
instance.version = 1
else:
instance.version = instance.history.count()
history_account = instance.history.first()
instance.version = history_account.version + 1 if history_account else 0
@merge_delay_run(ttl=5)