Change notifications API to use a replica (#25874)
parent
6ee7c03b28
commit
315002c1be
@ -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
|
Loading…
Reference in new issue