Skip to content

Commit 6b9d5f5

Browse files
committed
formatting
1 parent 0bf3f5c commit 6b9d5f5

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

bin/format

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
clojure -M:cljfmt fix src test "$@"

src/tako/tako.clj

+13-12
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@
1818
t (timeout max-time)]
1919
(let [[v p] (alts! [in t])]
2020
(cond
21-
;; timed out, so process what we got
21+
;; timed out, so process what we got
2222
(= p t)
2323
(do
2424
(when (seq buf)
2525
(>! out buf))
2626
(recur [] (timeout max-time)))
2727

28-
;; `in` is closed, so process what we got
28+
;; `in` is closed, so process what we got
2929
(nil? v)
3030
(do
3131
(when (seq buf)
3232
(>! out buf))
3333
(close! out))
3434

35-
;; we will fill up the batch, so process it
35+
;; we will fill up the batch, so process it
3636
(== lim-1 (count buf))
3737
(do
3838
(>! out (conj buf v))
3939
(recur [] (timeout max-time)))
4040

41-
;; accumulate the buffer
41+
;; accumulate the buffer
4242
:else
4343
(recur (conj buf v) t))))))
4444

@@ -64,7 +64,7 @@
6464
([fetch-fn] (start! fetch-fn nil))
6565
([fetch-fn opts]
6666
(let [{:keys [max-batch-size max-batch-time buffer-size]
67-
:or {max-batch-size Integer/MAX_VALUE, max-batch-time 5, buffer-size 1000}} opts
67+
:or {max-batch-size Integer/MAX_VALUE, max-batch-time 5, buffer-size 1000}} opts
6868
c-in (chan buffer-size)
6969
c-batches (chan)
7070
promises (atom {})
@@ -76,7 +76,7 @@
7676
ps @promises]
7777

7878
(cond
79-
;; got a batch to process
79+
;; got a batch to process
8080
(seq ids)
8181
(do
8282
(log/debug "processing id" ids)
@@ -86,19 +86,19 @@
8686
e))]
8787
(if (instance? Exception res)
8888
(doseq [k ids]
89-
;; Deliver the exception but clear the cache
89+
;; Deliver the exception but clear the cache
9090
(deliver (get ps k) res)
9191
(swap! promises dissoc k))
9292
(doseq [[k v] (zipmap ids res)]
93-
;; Deliver the value
93+
;; Deliver the value
9494
(deliver (get ps k) v))))
9595
(recur))
9696

97-
;; chan is closed
97+
;; chan is closed
9898
(nil? ids)
9999
(log/debug "c-batches closed")
100100

101-
;; keep listening
101+
;; keep listening
102102
:else
103103
(recur))))
104104

@@ -176,7 +176,8 @@
176176
(stop! loader)
177177

178178
(with-open [ld (start! batch-fn {})]
179-
(println) (deref (load-many ld ["alice" "bob"])))
179+
(doto (deref (load-many ld ["alice" "bob"]))
180+
println))
180181

181182
(with-open [ld (start! batch-fn {})]
182-
(println (deref (load-one ld "clair")))))
183+
(deref (load-one ld "clair"))))

0 commit comments

Comments
 (0)