diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-23 18:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-23 18:09:45 +0300 |
commit | 99c1dfd5e3f39868d65cb006078a8d091992fa54 (patch) | |
tree | 18d970852272c6d5ba303911da13d16cbff2514c /lib/gitlab/counters | |
parent | 23634aa773e10e7df79247fb6fddbce88b825909 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/counters')
-rw-r--r-- | lib/gitlab/counters/buffered_counter.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/counters/legacy_counter.rb | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/gitlab/counters/buffered_counter.rb b/lib/gitlab/counters/buffered_counter.rb index e662dfeef1e..eb701e16d2a 100644 --- a/lib/gitlab/counters/buffered_counter.rb +++ b/lib/gitlab/counters/buffered_counter.rb @@ -31,9 +31,9 @@ module Gitlab end end - def increment(amount) + def increment(increment) result = redis_state do |redis| - redis.incrby(key, amount) + redis.incrby(key, increment.amount) end FlushCounterIncrementsWorker.perform_in(WORKER_DELAY, counter_record.class.name, counter_record.id, attribute) @@ -45,7 +45,7 @@ module Gitlab result = redis_state do |redis| redis.pipelined do |pipeline| increments.each do |increment| - pipeline.incrby(key, increment) + pipeline.incrby(key, increment.amount) end end end diff --git a/lib/gitlab/counters/legacy_counter.rb b/lib/gitlab/counters/legacy_counter.rb index 98cf8853321..0d976eaa346 100644 --- a/lib/gitlab/counters/legacy_counter.rb +++ b/lib/gitlab/counters/legacy_counter.rb @@ -11,19 +11,19 @@ module Gitlab @current_value = counter_record.method(attribute).call end - def increment(amount) - updated = update_counter_record_attribute(amount) + def increment(increment) + updated = update_counter_record_attribute(increment.amount) if updated == 1 counter_record.execute_after_commit_callbacks - @current_value += amount + @current_value += increment.amount end @current_value end def bulk_increment(increments) - total_increment = increments.sum + total_increment = increments.sum(&:amount) updated = update_counter_record_attribute(total_increment) |