duct-framework / server.http.jetty

Integrant methods for running a Jetty web server
3 stars 3 forks source link

suspend/resume breaks when you change a route #3

Closed flyingmachine closed 7 years ago

flyingmachine commented 7 years ago

I'm working with the example app and found that if you suspend the system, change the config by removing the example route, and resume the system, the HTTP server will stop and not restart. To repro:

;; in repl
(require
  '[integrant.core :as ig]
  '[integrant.repl :as ir]
  '[duct.core :as duct]
  '[clojure.java.io :as io])

(ir/set-prep! #(duct/prep (duct/read-config (io/resource "duct_9/config.edn"))))
(ir/go)
(ir/suspend)
;; modify config.edn, removing example route
(ir/resume)

Here's what my config.edn looks like after I edit it:

{:duct.core/project-ns  duct-9
 :duct.core/environment :production

 :duct.module/logging {}
 :duct.module.web/site {}

 :duct.router/cascading
 []}
flyingmachine commented 7 years ago

It looks like integrant.core/resume halts the server, but resume-key thinks the config hasn't changed so it doesn't restart it

weavejester commented 7 years ago

It looks like this is an issue with Integrant. What we probably want to do is change this line:

(halt! system (missing-keys system keys))

Which halts all missing keys and the keys that depend on them. Instead, it should probably be something more like:

(halt! (apply dissoc system (missing-keys system keys)))

But I'll need to think about the consequences and make sure I have the logic right.

weavejester commented 7 years ago

This should be fixed by Integrant 0.4.1. I've updated the dependencies for server.http.jetty to include that, and released server.http.jetty 0.1.5.

flyingmachine commented 7 years ago

awesome! so far so good :)