Class: Gitlab::Database::Consistency

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/consistency.rb

Overview

This class is used to make it possible to ensure read consistency in GitLab without the need of overriding a lot of methods / classes / classs.

Class Method Summary collapse

Class Method Details

.with_read_consistency(&block) ⇒ Object

Within the block, disable the database load balancing for calls that require read consistency after recent writes.


15
16
17
18
# File 'lib/gitlab/database/consistency.rb', line 15

def self.with_read_consistency(&block)
  ::Gitlab::Database::LoadBalancing::Session
    .current.use_primary(&block)
end