diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 12:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 12:08:36 +0300 |
commit | 19e00b948726c0f7ca27dd92200493803499a4e1 (patch) | |
tree | 0df898db4ba20af4b4de2baf39285fe4d113d148 /app/models/concerns | |
parent | ca5ebd2044ce696cc1aafc8a80a606e20f2c9e4b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/counter_attribute.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/concerns/counter_attribute.rb b/app/models/concerns/counter_attribute.rb index f1efbba67e1..1f838ee911f 100644 --- a/app/models/concerns/counter_attribute.rb +++ b/app/models/concerns/counter_attribute.rb @@ -97,6 +97,14 @@ module CounterAttribute end end + def bulk_increment_counter(attribute, increments) + run_after_commit_or_now do + new_value = counter(attribute).bulk_increment(increments) + + log_increment_counter(attribute, increments.sum, new_value) + end + end + def update_counters_with_lease(increments) detect_race_on_record(log_fields: { caller: __method__, attributes: increments.keys }) do self.class.update_counters(id, increments) |