Use Primary DB when conection to read replica is refused. #4433
Unanswered
LaurinBrechter
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using drizzle with a primary cloud db and a read replica that is co-located with my server. I am doing something like this to set up the connection:
Now, the problem is that when my local db goes down I get an error for read operations. This would be manageable for queries that I make myself since I could make a wraper function that checks for an
ECONNREFUSED
error when making the query and then switches to the primary. But there's external libraries likebetter-auth
ornext-auth
to which you can only pass thedb
object.Is there an option for drizzle to detect that the read replica is down and then switch to the primary? Another option I see is that one checks in the callback that decides which db to use if the read replica is still there:
Beta Was this translation helpful? Give feedback.
All reactions