Skip to content

Commit ecf92f3

Browse files
committed
Refactor and clean up
1 parent 24f7efd commit ecf92f3

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/ghostwheel/core.cljc

+7-8
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@
808808
{:jsdoc [(str "@return {" (string/join "|" ret-types) "}")]}))))
809809

810810

811-
(defn- merge-config [env metadata]
811+
(defn- merge-config [metadata]
812812
(s/assert ::ghostwheel-config
813813
(->> (merge (u/get-base-config)
814814
(meta *ns*)
@@ -822,11 +822,11 @@
822822

823823

824824
(defn- generate-fdef
825-
[forms env]
825+
[forms]
826826
(let [{[type fn-name] :name bs :bs} (s/conform ::>fdef-args forms)]
827827
(case type
828828
:sym (let [quoted-qualified-fn-name (get-quoted-qualified-fn-name fn-name)
829-
{:keys [::instrument ::outstrument]} (merge-config env (meta fn-name))
829+
{:keys [::instrument ::outstrument]} (merge-config (meta fn-name))
830830
instrumentation (cond outstrument `(ost/instrument ~quoted-qualified-fn-name)
831831
instrument `(st/instrument ~quoted-qualified-fn-name)
832832
:else nil)
@@ -934,8 +934,7 @@
934934
(generate-type-annotations env fn-bodies)
935935
{::ghostwheel true})
936936
;;; Assemble the config
937-
config (merge-config env
938-
(merge (meta fn-name) meta-map))
937+
config (merge-config (merge (meta fn-name) meta-map))
939938
color (if-let [color (get l/ghostwheel-colors (::trace-color config))]
940939
color
941940
(:black l/ghostwheel-colors))
@@ -1159,7 +1158,7 @@
11591158
`(st/unstrument (quote ~extrument)))])))))))
11601159

11611160

1162-
(defn- generate-after-check [env callbacks]
1161+
(defn- generate-after-check [callbacks]
11631162
(let [{:keys [::check]}
11641163
(merge (u/get-base-config)
11651164
(meta *ns*))]
@@ -1223,7 +1222,7 @@
12231222
correctly in the build system post-reload hooks."
12241223
[& callbacks]
12251224
(when (u/get-env-config)
1226-
(cond-> (generate-after-check &env callbacks)
1225+
(cond-> (generate-after-check callbacks)
12271226
(cljs-env? &env) (clj->cljs false))))
12281227

12291228

@@ -1286,6 +1285,6 @@
12861285
[name ([params*] gspec) +])}
12871286
[& forms]
12881287
(when (u/get-env-config)
1289-
(cond-> (remove nil? (generate-fdef forms &env))
1288+
(cond-> (remove nil? (generate-fdef forms))
12901289
(cljs-env? &env) clj->cljs)))
12911290

src/ghostwheel/utils.cljc

+4-5
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,11 @@
137137
#?(:clj (= (System/getProperty "ghostwheel.cache") "false")))
138138
(reload-config)
139139
(let [now (identity #?(:clj (System/currentTimeMillis) :cljs (js/Date.now)))]
140-
(if (> (- now (::timestamp @*config-cache))
140+
(if (< (- now (::timestamp @*config-cache))
141141
2000)
142-
(::value (reset! *config-cache
143-
{::timestamp now
144-
::value (reload-config)}))
145-
(::value @*config-cache)))))))
142+
(::value @*config-cache)
143+
(::value (reset! *config-cache {::timestamp now
144+
::value (reload-config)}))))))))
146145

147146

148147
(defn get-base-config

0 commit comments

Comments
 (0)