-
Notifications
You must be signed in to change notification settings - Fork 341
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
Cannot detect if Spring is running #634
Comments
I've felt this pain as well. There are a number of scenarios where you need to be able to reliably hook into whether you're in a forked spring process or not in order to properly initializer connections. For example, the ruby grpc client has a check to make sure you don't initialize a connection in a child process when you've already done so in a parent process. I've seen scenarios where the |
In my Rails 7.0.7.2 app Spring is always loaded, even with |
In my case, another gem was loading Spring by doing |
The docs say:
But
Spring
is defined when runningrails s
even without Spring.With this code inside an initializer:
The output from
rails test
is:Which is as expected. Running
DISABLE_SPRING=1 rails test
gives:Which is also the expected outcome.
However, running either
rails s
orDISABLE_SPRING=1 rails s
gives the same output:In short, the documented check for whether Spring is active or not seems to return a false positive for certain Rails commands.
The text was updated successfully, but these errors were encountered: