File tree 3 files changed +30
-6
lines changed
3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change
1
+ /target
2
+ pom.xml
3
+ /.lein- *
4
+ profiles.clj
5
+ /.env
6
+ .nrepl-port
7
+ /.clj-kondo /.cache /
8
+ /.lsp /.cache /
9
+ /.calva /output-window /
Original file line number Diff line number Diff line change 1
- (defproject luminus-http-kit " 0.1.9 "
1
+ (defproject luminus-http-kit " 0.2.0-SNAPSHOT "
2
2
:description " HTTP Kit adapter for Luminus"
3
3
:url " https://github.com/luminus-framework/luminus-http-kit"
4
4
:license {:name " Eclipse Public License"
5
5
:url " http://www.eclipse.org/legal/epl-v10.html" }
6
- :dependencies [[org.clojure/clojure " 1.10.1" ]
7
- [org.clojure/tools.logging " 0.4.0" ]
8
- [http-kit " 2.5.0" ]])
6
+ :plugins [[lein-ancient " 1.0.0-RC3" ]]
7
+ :dependencies [[org.clojure/clojure " 1.11.1" ]
8
+ [org.clojure/tools.logging " 1.2.4" ]
9
+ [http-kit " 2.6.0" ]])
Original file line number Diff line number Diff line change 2
2
(:require [clojure.tools.logging :as log]
3
3
[org.httpkit.server :as http-kit]))
4
4
5
- (defn start [{:keys [handler host port] :as opts}]
5
+ ; ; i know nothing about http-kit, but this blog post has a conversion function
6
+ ; ; https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html
7
+ ; ; with-channel is deprecated though, so i rewrote it to use as-channel
8
+ (defn async-ring->httpkit2 [handler]
9
+ (fn [request]
10
+ (http-kit/as-channel
11
+ request
12
+ {:on-open (fn [ch]
13
+ (handler request
14
+ #(http-kit/send! ch %)
15
+ (fn [_] (http-kit/close ch))))})))
16
+
17
+ (defn start [{:keys [handler host port async?] :as opts}]
6
18
(try
7
19
(log/info " starting HTTP server on port" port)
8
20
(http-kit/run-server
9
- handler
21
+ (if async?
22
+ (async-ring->httpkit2 handler)
23
+ handler)
10
24
(-> opts
11
25
(assoc :legacy-return-value? false )
12
26
(dissoc :handler :init )))
You can’t perform that action at this time.
0 commit comments