0
0
Fork 0

Change notifications API to use a replica (#25874)

This commit is contained in:
Eugen Rochko 2023-07-12 17:06:00 +02:00 committed by GitHub
parent 82e477b184
commit fdc3ff7c2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 11 deletions

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
module DatabaseHelper
def with_read_replica(&block)
ApplicationRecord.connected_to(role: :read, prevent_writes: true, &block)
end
def with_primary(&block)
ApplicationRecord.connected_to(role: :primary, &block)
end
end