Skip to content
Snippets Groups Projects

Add lease to update project statistics row and log concurrent updates

Merged Albert requested to merge 373595-lock-on-project-statistics-update into master
Compare and Show latest version
4 files
+ 143
24
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -95,9 +95,7 @@ def flush_increments_to_database!(attribute)
next if increment_value == 0
transaction do
with_lock('FOR UPDATE') do
unsafe_update_counters(id, attribute => increment_value)
end
update_counters_with_lock({ attribute => increment_value })
redis_state { |redis| redis.del(flushed_key) }
new_db_value = reset.read_attribute(attribute)
end
Loading