Skip to content

Commit

Permalink
fix: 修改模型方法问题 #7626
Browse files Browse the repository at this point in the history
  • Loading branch information
guohelu committed Dec 13, 2024
1 parent 53ebf3a commit 79fb051
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gcloud/contrib/template_market/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from gcloud import err_code

TEMPLATE_SHARED_RECORD_BATCH_OPERATION_COUNT = 50


class TemplateSharedManager(models.Manager):
def update_shared_record(
Expand Down Expand Up @@ -66,9 +68,12 @@ def update_shared_record(
new_records.append(new_record)

if new_records:
TemplateSharedRecord.objects.bulk_create(new_records)
TemplateSharedRecord.objects.bulk_create(batch_size=TEMPLATE_SHARED_RECORD_BATCH_OPERATION_COUNT)

if records_to_update:
TemplateSharedRecord.objects.bulk_update(records_to_update, ["extra_info"])
TemplateSharedRecord.objects.bulk_update(
records_to_update, ["extra_info"], batch_size=TEMPLATE_SHARED_RECORD_BATCH_OPERATION_COUNT
)

return {"result": True, "message": "update shared record successfully", "code": err_code.SUCCESS.code}

Expand Down

0 comments on commit 79fb051

Please sign in to comment.