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
All threads resolved!
Compare and Show latest version
4 files
+ 141
21
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -94,8 +94,8 @@ def flush_increments_to_database!(attribute)
next if increment_value == 0
with_lock('FOR UPDATE') do
unsafe_update_counters(id, attribute => increment_value)
transaction do
update_counters_with_lock({ attribute => increment_value })
redis_state { |redis| redis.del(flushed_key) }
new_db_value = reset.read_attribute(attribute)
end
Loading