Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
not allowing QueryCache Rack to fail on database exception (#2142) #2227
I've been testing this (see sample app: https://github.com/skippy/rails31QueryCache) and I actually think this is a bigger issue than raised in #2142. The query cache is triggered so early in the rack stack that if something goes wrong with the database (such as a misconfiguration or it goes down) it becomes a bit tricky to capture that error... you definitely can't do it from the controller level (it looks like hoptoad works as it monkey patches low enough to grab the error).
I think @pritchie has a valid point so here is my attempt to address it. if it fails in the
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
@pritchie, addressing the 3 points in order:
I think it's reasonable to expect driver errors to inherit from StandardError. See:
Not turning on the query cache if the original connection feels like a bug. Perhaps a smaller bug than failing to start up at all, but a bug all the same.
Lazy load feels like the right option, but from looking at /connection_adapters/abstract/connection_pool.rb that's going to be adapter specific... given that some form of middleware or helper class might be cleaner.