ring-clojure / ring

Clojure HTTP server abstraction
MIT License
3.75k stars 519 forks source link

Load most recent namespaces first to fix reloading issue #376 #377

Closed tendant closed 5 years ago

tendant commented 5 years ago

Reverse the order of namespaces to load most recent updated namespace first.

weavejester commented 5 years ago

Can you add a test that demonstrates the issue being fixed?

tendant commented 5 years ago

How to test reload programmatically? I did manual testing with sample project: https://github.com/tendant/ring-reload-debug

Test case:

  1. Start ring server
  2. Change (b/f1) to (b/f2) in namespace "ring-reload-debug.a", refresh page, it fails.
  3. Change function definition from f1 to f2 in namespace "ring-reload-debug.b", refresh page.

With ring-devel 1.7.1, Step 3 will fail.

With this patch, Step 3 will load namespace correctly.

weavejester commented 5 years ago

I had it in my head that there was some tests for wrap-reload already that you could hook into, but went I looked there was only a smoke test.

I've tested it manually with the project you supplied, and it works as you say. Can you change the commit message to:

Change namespace reload order in wrap-reload

Fixes #376.

Then I'll merge it in.

tendant commented 5 years ago

I have force pushed to fix commit message. Please let me know if it works. Thanks.