weavejester / ring-server

51 stars 24 forks source link

Provide an option to re-resolve handler per request. #23

Closed MichaelBlume closed 8 years ago

MichaelBlume commented 9 years ago

Stuart Sierra's tools.namespace library reloads namespaces by creating entirely new Var objects. For developers using it in their workflow, a server which holds a reference to a Var object won't successfully pick up changes. Provide an option to resolve the var on every request.

weavejester commented 9 years ago

This seems reasonable.

Before it's merged, could you remove the ending period from the git summary line (the first line) so it's in line with the other commits in the repository?

MichaelBlume commented 9 years ago

Yep, no problem.

MichaelBlume commented 8 years ago

?

weavejester commented 8 years ago

Sorry, this slipped through my inbox.

Now that I look at this again, I'm not quite clear on your use-case for this. You're using tools.namespace, suggesting that you're performing a manual reload through the REPL, yet the changes you've made are to a namespace designed to be run via Leiningen.

Could you explain your use-case in more detail?

MichaelBlume commented 8 years ago

So lein-ring can optionally start up an nrepl server when invoked with 'lein ring server', so a lot of times, I'll start up my app that way, connect through the repl, and then occasionally reload/test my code, but the server holds onto the original var for my handler, so it doesn't quite work (unless I write the re-resolve logic into my handler, but I don't really want to do that)

On Thu, Mar 3, 2016 at 4:50 PM James Reeves notifications@github.com wrote:

Sorry, this slipped through my inbox.

Now that I look at this again, I'm not quite clear on your use-case for this. You're using tools.namespace, suggesting that you're performing a manual reload through the REPL, yet the changes you've made are to a namespace designed to be run via Leiningen.

Could you explain your use-case in more detail?

— Reply to this email directly or view it on GitHub https://github.com/weavejester/ring-server/pull/23#issuecomment-192038983 .

MichaelBlume commented 8 years ago

Ping?

On Sun, Mar 6, 2016 at 10:04 AM Michael Blume blume.mike@gmail.com wrote:

So lein-ring can optionally start up an nrepl server when invoked with 'lein ring server', so a lot of times, I'll start up my app that way, connect through the repl, and then occasionally reload/test my code, but the server holds onto the original var for my handler, so it doesn't quite work (unless I write the re-resolve logic into my handler, but I don't really want to do that)

On Thu, Mar 3, 2016 at 4:50 PM James Reeves notifications@github.com wrote:

Sorry, this slipped through my inbox.

Now that I look at this again, I'm not quite clear on your use-case for this. You're using tools.namespace, suggesting that you're performing a manual reload through the REPL, yet the changes you've made are to a namespace designed to be run via Leiningen.

Could you explain your use-case in more detail?

— Reply to this email directly or view it on GitHub https://github.com/weavejester/ring-server/pull/23#issuecomment-192038983 .

weavejester commented 8 years ago

Once more this PR slipped out of my inbox. I'll give you access to the project instead, and you can merge the PR yourself, since it's clearly not something I'm maintaining :)

MichaelBlume commented 8 years ago

Cool =)