Unable to override default options
seanvm opened this issue · comments
Sean van Mulligen commented
We recently encountered an issue where we were unable to override the default options for a specific query. We set defaults for distribute_reads
like this:
DistributeReads.default_options = {
max_lag: 1,
lag_failover: true,
failover: true
}
We have a specific query that we want to prevent from falling back to the primary db:
distribute_reads(max_lag: 100, lag_failover: false) do
# Expect this to raise DistributeReads::TooMuchLag if replication lag is > 100 seconds
my_query
end
However, we are still seeing this query running on the primary db when there is significant replication lag. Is there some other setting we are missing, or is it not possible to override the lag_failover
default?
We are on version 0.3.5
of distribute_reads.
Andrew Kane commented
Hi @seanvm, I'm not sure how to reproduce. You'll also want to pass failover: false
if you never want it to run on primary.