File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed
examples/billion_checkboxes_blob/src/app Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 506506
507507(comment
508508 (do (-main ) nil )
509- ; ; (clojure.java.browse/browse-url "http ://localhost:8080 /")
509+ ; ; (clojure.java.browse/browse-url "https ://localhost:3030 /")
510510
511511
512512 ; ; stop server
588588 (fn [_]
589589 (run!
590590 (fn [_]
591- (wrapped-router
592- {:headers
593- {" accept-encoding" " br"
594- " cookie" " __Host-sid=5SNfeDa90PhXl0expOLFGdjtrpY; __Host-csrf=3UsG62ic9wLsg9EVQhGupw"
595- " content-type" " application/json" }
596- :request-method :post
597- :uri handler-check
598- :body {:csrf " 3UsG62ic9wLsg9EVQhGupw"
599- :parentid " 0"
600- :targetid (str (rand-int 200 ))}}))
591+ (-> (wrapped-router
592+ {:headers
593+ {" accept-encoding" " br"
594+ " cookie" " __Host-sid=5SNfeDa90PhXl0expOLFGdjtrpY; __Host-csrf=I3AAFrMG99lxoqwi87cSpn7unri5qYqJ-Vr9DLc4-s4"
595+ " content-type" " application/json" }
596+ :request-method :post
597+ :uri handler-check
598+ :body
599+ {:csrf " I3AAFrMG99lxoqwi87cSpn7unri5qYqJ-Vr9DLc4-s4"
600+ :parentid " 0"
601+ :targetid (str (rand-int 200 ))}})))
601602 ; ; 10000r/s
602603 (range 10 ))
603604 (Thread/sleep 1 ))
Original file line number Diff line number Diff line change 55
66(defn batch!
77 " Wraps side-effecting function in a queue and batch mechanism. The
8- batch is run every X ms when not empty and/or if it reaches it's max
9- size. Function must take a vector of items. Supports back pressure."
10- [effect-fn & {:keys [run-every-ms max-size]
11- :or {run-every-ms 100
12- max-size 1000 }}]
8+ batch is run every X ms when not empty. Function must take a vector of items. Supports back pressure."
9+ [effect-fn & {:keys [run-every-ms]
10+ :or {run-every-ms 100 }}]
1311 (let [<in (a/chan 1000 )] ; ; potentially pass this channel in
1412 (util/thread
1513 (loop [<t (a/timeout run-every-ms)
2119 (recur (a/timeout run-every-ms) batch)
2220
2321 ; ; Run batch
24- (or (= p <t)
25- (and (= p <in) (>= (count batch) max-size)))
22+ (= p <t)
2623 (let [; ; Timer is started before task to prevent task duration
2724 ; ; from affecting interval (unless it exceeds interval).
2825 <new-t (a/timeout run-every-ms)]
You can’t perform that action at this time.
0 commit comments