-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Obvious N+1 query not detected in RSpec (when setup code is run before it) #653
Comments
Here is the Bullet debug output for the example where it does NOT detect the N+1 query.
And for reference, here is the output of the second variation, where Bullet does detect the problem:
|
@jessevdp I'm experiencing the same issue. Did you figure it out? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey 👋
I'm attempting to set-up Bullet to run in my RSpec tests to detect N+1 queries and whatnot. I've followed the setup outlined in the README (here), and set a fairly obvious N+1 example that does trigger a Bullet notification when run in a controller.
I can't quite explain why, but Bullet seems to NOT detect N+1 queries when some other database interactions happen. To show what I mean consider the following two variations of the same RSpec test.
I've moved all the Bullet related code out of the general RSpec config and into the example. I've also moved the DB setup code out of a before hook into the example. This to show the timings off.
This does NOT trigger a Bullet warning
Note
Bullet.start_request
is invoked at the start of the example, before any DB interaction.This does trigger a Bullet warning
Note Bullet.start_request is run just before the actual querying code.
My environment
I run a fairly standard RSpec setup, the only other plugin I have setup is DatabaseCleaner, which should run entirely around the example. (To ensure this wasn't messing with things I moved all the Bullet code into the example.
Related issues
This might to be related to: #427. But I wanted to report this anyway since (1) that issue doesn't really have a fix, and (2) I have a more simplified version of the problem that does not have anything to do with RSpec hook execution order.
The text was updated successfully, but these errors were encountered: