Remove executor dependency from awsns handlers

This commit is contained in:
Andrey Antukh 2023-11-24 14:54:10 +01:00
parent 54341d5b22
commit ca6738d20c
2 changed files with 4 additions and 6 deletions

View file

@ -31,14 +31,13 @@
(defmethod ig/pre-init-spec ::routes [_] (defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::http/client (s/keys :req [::http/client
::main/props ::main/props
::db/pool ::db/pool]))
::wrk/executor]))
(defmethod ig/init-key ::routes (defmethod ig/init-key ::routes
[_ {:keys [::wrk/executor] :as cfg}] [_ cfg]
(letfn [(handler [request] (letfn [(handler [request]
(let [data (-> request rreq/body slurp)] (let [data (-> request rreq/body slurp)]
(px/run! executor #(handle-request cfg data))) (px/run! :vthread (partial handle-request cfg data)))
{::rres/status 200})] {::rres/status 200})]
["/sns" {:handler handler ["/sns" {:handler handler
:allowed-methods #{:post}}])) :allowed-methods #{:post}}]))

View file

@ -228,8 +228,7 @@
::http.awsns/routes ::http.awsns/routes
{::props (ig/ref ::setup/props) {::props (ig/ref ::setup/props)
::db/pool (ig/ref ::db/pool) ::db/pool (ig/ref ::db/pool)
::http.client/client (ig/ref ::http.client/client) ::http.client/client (ig/ref ::http.client/client)}
::wrk/executor (ig/ref ::wrk/executor)}
::http/server ::http/server
{::http/port (cf/get :http-server-port) {::http/port (cf/get :http-server-port)