Skip to content

Commit f9d70e8

Browse files
committed
Drop CL-style const earmuffs
... and mark `probe-hint-marker` const for real.
1 parent a0a7c2c commit f9d70e8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: test/aleph/resource_leak_detector.clj

+8-8
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,21 @@
5757
(str "`aleph.resource_leak_detector` requires `-Dio.netty.leakDetection.level=PARANOID`. "
5858
"Current level is `" (ResourceLeakDetector/getLevel) "`.")))))
5959

60-
(def +max-probe-gc-runs+
60+
(def max-probe-gc-runs
6161
"Maximum number of times the GC will be run to detect a leaked probe."
6262
10)
6363

64-
(def +probe-hint-marker+
64+
(def probe-hint-marker
6565
"ALEPH LEAK DETECTOR PROBE")
6666

6767
(defn hint-record-pattern [hint-pattern]
6868
(re-pattern (str "(?m)^\\s*Hint: " hint-pattern "$")))
6969

70-
(def +probe-hint-pattern+
71-
(hint-record-pattern (str +probe-hint-marker+ " \\d+")))
70+
(def probe-hint-pattern
71+
(hint-record-pattern (str probe-hint-marker " \\d+")))
7272

7373
(defn probe? [leak]
74-
(re-find +probe-hint-pattern+ (:records leak)))
74+
(re-find probe-hint-pattern (:records leak)))
7575

7676
(defn contains-hint? [hint leak]
7777
(re-find (hint-record-pattern hint) (:records leak)))
@@ -81,7 +81,7 @@
8181

8282
(let [cnt (atom 0)]
8383
(defn gen-probe-hint []
84-
(str +probe-hint-marker+ " " (swap! cnt inc))))
84+
(str probe-hint-marker " " (swap! cnt inc))))
8585

8686
(defn leak-probe! [hint]
8787
(-> AbstractByteBufAllocator/DEFAULT
@@ -98,10 +98,10 @@
9898
(-> AbstractByteBufAllocator/DEFAULT (.buffer 1) .release))
9999

100100
(defn await-probe! [probe-hint]
101-
(loop [n +max-probe-gc-runs+]
101+
(loop [n max-probe-gc-runs]
102102
(force-leak-detection!)
103103
(if (zero? n)
104-
(throw (RuntimeException. "Gave up awaiting leak probe. Try increasing +max-probe-gc-runs+."))
104+
(throw (RuntimeException. "Gave up awaiting leak probe. Try increasing `aleph.resource-leak-detector/max-probe-gc-runs`."))
105105
(when-not (some (partial contains-hint? probe-hint) @current-leaks)
106106
(recur (dec n))))))
107107

0 commit comments

Comments
 (0)