On Thursday, October 20, 2016 at 5:24:21 PM UTC-7, binarypaladin wrote:
>
> I recently tried moving to a master/slave setup using the slave as a read
> only. We're using Postgres 9.3. The configuration was easy enough, but I'm
> noticing what I'm pretty sure is replication lag given the errors coming
> back.
>
> For the purposes of our application, what I would like to is be able to
> set certain controller actions or situations to use the read only server
> (or servers in the future) and others that have to handle writes and
> sometimes combined reads to go to the master. Can I encapsulate things in a
> block or set a variable in certain contexts. I know I can force a server in
> a dataset with #server but I know there are going to be some contexts where
> I'd be easier just to wrap things in a block.
>
> Aaaand... as I typed this it appears that
> Database#synchronize(<server_name>) { ... } would do the trick. Would I be
> correct in this?
>
Alas, no. However, you can use the server_block extension, which supports
setting a default server for a given block of code.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.