-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Warning about middleware not auto-reloading #17187
Conversation
@@ -99,6 +99,14 @@ To find out more about different `rackup` options: | |||
$ rackup --help | |||
``` | |||
|
|||
### Development and auto-reloading | |||
|
|||
Once loaded, there's no way for Rails to auto-reload a middleware on changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is strange. What about 'Middlewares are loaded once and are not monitored for changes.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right. I'm going to change this.
👍 However thinking about it, for development, you could use something like this: class MiddlewareTester
def initialize(app, tested_middleware_const_name, require_path = nil)
@app = app
@tested_middleware_const_name = tested_middleware_const_name
@require_path = require_path
end
def call(env)
load(@require_path) if @require_path # might be brittle
tested_middleware_const_name.constantize.new(@app).call(env)
end
end |
|
||
Middlewares are loaded once and are not monitored for changes. | ||
|
||
Middleware changes will not be automatically picked up, you will have to restart the server for changes to be reflected in the running application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we are repeating ourself, we just said that they are not monitored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must say explicitly that the server has to be restarted for the changes to be effective. So what to do? Combine both sentences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about
are not monitored for changes.
and
Middleware changes will not be automatically picked up
Why does Travis build failed on a guide update? |
So it is not good enough to be included in the guide? |
Travis sometime timeout, please add [ci skip] in your commit message when sending doc. |
|
||
Middlewares are loaded once and are not monitored for changes. You will have to restart the server for changes to be reflected in the running application. | ||
|
||
As a middleware developer it means that you'll have to restart your test application on every single change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not this paragraph redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe yes, I wanted to emphasis on the fact that as a Rails developer of a middleware you have this strong constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove that.
@Bounga Please rebase/squash commits.. |
f018aa7
to
0a86ac3
Compare
@seuros Sorry about the rebase/squash lag. I was new to that so I had to dig about the good way to do it. The guide (http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-code) is missing a little tip about the command |
Add a section in the guide to explain that Rails can't auto-reload a middleware on code change. Fix rails#16806 [ci skip]
0a86ac3
to
094a7ce
Compare
Warning about middleware not auto-reloading
Thank you. |
Add a section in the guide to explain that Rails can't auto-reload
a middleware on code change.
Fix #16806