Should fix repl once more

This commit is contained in:
2024-02-08 20:36:04 -08:00
parent 959c4ed74f
commit 487a171693
4 changed files with 16 additions and 56 deletions

View File

@@ -1,5 +1,4 @@
(ns auto-ap.server
(:gen-class)
(:require
[auto-ap.handler :refer [app]]
[auto-ap.jobs.restore-from-backup :as job-restore-from-backup]
@@ -31,8 +30,6 @@
(org.eclipse.jetty.server.handler StatisticsHandler)
(org.eclipse.jetty.server.handler.gzip GzipHandler)))
(println "LOADING SERVER")
(defn add-shutdown-hook! [^Runnable f]
(.addShutdownHook (Runtime/getRuntime)
(Thread. f)))
@@ -156,9 +153,7 @@
:else
(do
(add-shutdown-hook! shutdown-mount)
(println "HI?")
(start-server :port 9000 :bind "0.0.0.0" #_#_:handler (cider-nrepl-handler))
(println "HI 2?")
(mount/start (mount/except (mount/only #{#'user/jetty})))
(mount/start)
#_(alter-var-root #'nrepl.middleware.print/*print-fn* (constantly clojure.pprint/pprint))))))

View File

@@ -1,5 +1,6 @@
(ns user
(:require [amazonica.aws.s3 :as s3]
[auto-ap.server]
[auto-ap.datomic :refer [conn pull-attr random-tempid]]
[auto-ap.solr :as solr]
[auto-ap.time :as atime]
@@ -357,47 +358,14 @@
:handler auto-reset-handler}]))
(defn gzip-handler []
(doto (GzipHandler.)
(.setIncludedMimeTypes (into-array ["text/css"
"text/plain"
"text/javascript"
"text/csv"
"text/html"
"text/html;charset=utf-8"
"application/javascript"
"application/csv"
"application/edn"
"application/json"
"image/svg+xml"]))
(.setMinGzipSize 1024)))
(defn configure-jetty [server]
(let [ gzip-handler (gzip-handler)
default-handler (.getHandler server)]
(.setHandler gzip-handler default-handler)
(.setHandler server gzip-handler))
(.setStopAtShutdown server true))
(mount/defstate port :start (Integer/parseInt (or (env :port) "3000")))
(mount/defstate jetty
:start (run-jetty app {:port port
:join? false
:configurator configure-jetty
:response-header-size 16384
:request-header-size 16384})
:stop (.stop jetty))
(defn start-http []
(mount.core/start (mount.core/only #{#'user/port #'user/jetty})))
(mount.core/start (mount.core/only #{#'auto-ap.server/port #'auto-ap.server/jetty})))
(defn start-dev []
(set-refresh-dirs "src")
#_(clojure.tools.namespace.repl/disable-reload! (find-ns 'auto-ap.server))
(clojure.tools.namespace.repl/disable-reload! (find-ns 'auto-ap.time))
#_(clojure.tools.namespace.repl/disable-reload! (find-ns 'auto-ap.time))
(start-db)
(start-http)
(auto-reset))