Skip to content

Commit 17f8cfa

Browse files
repl-workflow: quote handler to avoid repl restart
1 parent d49b3e2 commit 17f8cfa

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

docs/service-repl-workflow/donut-system.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The event log publisher and http service have no intrinsic relationship, so orde
110110
:http {:server
111111
#::donut{:start (fn http-kit-run-server
112112
[{{:keys [handler options]} ::donut/config}]
113-
(http-server/run-server handler options))
113+
(http-server/run-server #'handler options))
114114
:stop (fn http-kit-stop-server
115115
[{::donut/keys [instance]}]
116116
(instance))
@@ -120,6 +120,9 @@ The event log publisher and http service have no intrinsic relationship, so orde
120120
:handler (router/app (donut/ref [:env :persistence]))}}})
121121
```
122122

123+
!!! HINT "Quote handler function to evaluate changes"
124+
Use `#'` reader quote when passing the `handler` function to the server so that changes to the code called by the handler function can be updated by evaluating those changes in the REPL.
125+
123126

124127
## Start the system
125128

docs/service-repl-workflow/integrant/integrant-system.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Integrant implementation
22

3-
Define
3+
Define
44

55
* an integrant system configuration in `resources/config.edn`
66
* Integrant `init-key` used to start each component
77
* Integrant `halt-key!` to stop each component
8-
* Define `-main` function to load the system configuration, optionally parse with aero, start all components and hold a reference to the running system that listens to SIGTERM events
8+
* Define `-main` function to load the system configuration, optionally parse with aero, start all components and hold a reference to the running system that listens to SIGTERM events
99

1010

1111
## Prepare system
@@ -72,9 +72,13 @@ HTTP server start - returns function to stop the server
7272
(defmethod ig/init-key ::http-server
7373
[_ {:keys [handler port join?]}]
7474
(mulog/log ::http-server-component :handler handler :port port :local-time (java.time.LocalDateTime/now))
75-
(http-server/run-server handler {:port port :join? join?}))
75+
(http-server/run-server #'handler {:port port :join? join?}))
7676
```
7777

78+
!!! HINT "Quote handler function to evaluate changes"
79+
Use `#'` reader quote when passing the `handler` function to the server so that changes to the code called by the handler function can be updated by evaluating those changes in the REPL.
80+
81+
7882
## Shutdown Components
7983

8084
Define how each component should be halted (if required)
@@ -181,11 +185,11 @@ Shutdown the mulog event publisher process, including a `(Thread/sleep 250)` to
181185
(:require
182186
;; Component system
183187
[{{top/ns}}.{{main/ns}}.parse-system :as parse-system]
184-
188+
185189
;; System dependencies
186190
[integrant.core :as ig]
187191
[com.brunobonacci.mulog :as mulog]))
188-
192+
189193
;; --------------------------------------------------
190194
;; Configure and start application components
191195

@@ -247,4 +251,3 @@ Shutdown the mulog event publisher process, including a `(Thread/sleep 250)` to
247251
(ig/halt! system))
248252
;; --------------------------------------------------
249253
```
250-

0 commit comments

Comments
 (0)