-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Realtime rebuild #591
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
Realtime rebuild #591
Conversation
This is done by design, to prevent rebuilding multiple times when saving multiple files (or saving a file multi 8000 ple times). @revel/core should we make it configurable? |
@pushrax a configurable option would be nice. I could see this being acceptable in dev mode, but not production. |
I see. |
Sounds good @k0kubun. We may add it ourselves for the next release if you aren't able to by then, so please keep us up to date on your progress. |
Thanks to accept the feature request. I added rebuild.eager option to enable this feature, and it is set to false by default. |
if !strings.HasPrefix(path.Base(ev.Name), ".") { | ||
if dl, ok := listener.(DiscerningListener); ok { | ||
if !dl.WatchFile(ev.Name) || ev.IsAttrib() { | ||
continue |
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 nesting has gotten too deep, I think this should be extracted into a method.
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.
That's true. It became hard to read.
I splitted the logic into w.rebuildRequired()
in d451f28
We're getting close here 🍰 |
This will probably solve my problem with working on "jobs related code", ie not http stuff.. |
+1 |
Also, is there a better word than |
That's true. Since this option is created to decide whether harness rebuilds eagerly or not, how about |
@k0kubun or |
1e6a0d6
to
6921e93
Compare
I rebased to resolve a conflict but made CI failed. Sorry...
Thank you for nice suggestion! It seems more natural than my idea. |
http://godoc.org/gopkg.in/fsnotify.v1#Watcher
|
I think so. I fixed some error in edd4773, but still have some problems. |
edd4773
to
fbc276a
Compare
TravisCI is passing. Do I have your green light to merge? |
I changed the option to enable this feature. 79abc3f |
Adds eager, realtime rebuild
How about |
Oh, it's merged already. Will push another commit to fix up a spelling mistake. |
Thank you 💓 |
Problem
Because Revel receives file change events when receiving HTTP requests,
Revel does not rebuild an application until a browser reload or something.
Solution
But you can start to rebuild the application when the file is changed if you watch file change events in real time.
So I created goroutine to receive them.
Because a select statement without default case waits until receiving events, its performance didn't become worse.