File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 55 (:require [muuntaja.core :as m]
66 [clojure.java.io :as io]
77 [clojure.string :as str]
8+ [clojure.tools.logging :as log]
89 [xtdb.api :as xt]
910 [xtdb.node :as xtn]
1011 [xt-play.config :as config]
1112 [xt-play.base64 :as b64]
1213 [xt-play.handler :as h]))
1314
15+ (defn- clear-directory
16+ " Recursively delete all contents of a directory"
17+ [^java.io.File dir]
18+ (when (.exists dir)
19+ (doseq [file (.listFiles dir)]
20+ (if (.isDirectory file)
21+ (do
22+ (clear-directory file)
23+ (.delete file))
24+ (.delete file)))
25+ (log/info " Cleared disk cache directory:" (.getPath dir))))
26+
1427(defn -init []
28+ ; Clear disk cache from previous Lambda container executions
29+ (clear-directory (io/file " /tmp/xtdb-cache" ))
30+
1531 ; NOTE: This ensure xtdb is warmed up before starting the server
1632 ; Otherwise, the first few requests will time out
1733 (with-open [node (xtn/start-node config/node-config)]
You can’t perform that action at this time.
0 commit comments