Skip to content

Made develop mode autorun on start #95

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

Merged
merged 1 commit into from
Aug 4, 2017
Merged

Conversation

notzippy
Copy link
Contributor

  • Modified proxy so application is launched on start of proxy, so a new request is not required to start the application.
  • Moved watcher inside harness

@brendensoares
Copy link
Member

Is watcher not used within the revel lib?

@notzippy
Copy link
Contributor Author

notzippy commented Jul 28, 2017 via email

renderError(w, r, err)
return
// If app did not start when harness was run then trigger the build to capture the error
if h.app==nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h.app == nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

// Render an error page if the rebuild / restart failed.
err := h.watcher.Notify()
if err != nil {
atomic.CompareAndSwapInt32(&lastRequestHadError, 0, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompareAndSwapInt32 is kind of obscure, we should add comments to lines referencing this method to communicate our intent which I believe has to do with syncing up the concurrent change to lastRequestHadError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, I guess there could be a race condition where the browser requests the favicon immediately following the page request. I don't know if it is crucial to be this way - but it isnt hurting anything by being there

watcher.Listen(h, paths...)
h.watcher = revel.NewWatcher()
h.watcher.Listen(h, paths...)
h.watcher.Notify()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the line that causes the build in dev mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the notify triggers the build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h.watcher.Notify() is yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment saying so so the intent is clear?

@notzippy notzippy force-pushed the autorun branch 2 times, most recently from 90d228f to 196f779 Compare July 28, 2017 20:26
Modified proxy so application is launched on startup
watcher.Listen(h, paths...)
h.watcher = revel.NewWatcher()
h.watcher.Listen(h, paths...)
h.watcher.Notify()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment saying so so the intent is clear?

@notzippy notzippy merged commit 79b2afb into revel:develop Aug 4, 2017
@notzippy notzippy deleted the autorun branch August 4, 2017 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants