mirror of
https://github.com/penpot/penpot.git
synced 2025-02-04 13:29:14 -05:00
📎 Minor changes on internal audit module buffers.
This commit is contained in:
parent
71524fe649
commit
585e5d0199
2 changed files with 5 additions and 3 deletions
|
@ -75,9 +75,9 @@
|
||||||
[_ {:keys [enabled] :as cfg}]
|
[_ {:keys [enabled] :as cfg}]
|
||||||
(when enabled
|
(when enabled
|
||||||
(l/info :msg "intializing audit collector")
|
(l/info :msg "intializing audit collector")
|
||||||
(let [input (a/chan 1 event-xform)
|
(let [input (a/chan 512 event-xform)
|
||||||
buffer (aa/batch input {:max-batch-size 100
|
buffer (aa/batch input {:max-batch-size 100
|
||||||
:max-batch-age (* 5 1000)
|
:max-batch-age (* 10 1000) ; 10s
|
||||||
:init []})]
|
:init []})]
|
||||||
(a/go-loop []
|
(a/go-loop []
|
||||||
(when-let [[type events] (a/<! buffer)]
|
(when-let [[type events] (a/<! buffer)]
|
||||||
|
|
|
@ -64,12 +64,14 @@
|
||||||
(defn batch
|
(defn batch
|
||||||
[in {:keys [max-batch-size
|
[in {:keys [max-batch-size
|
||||||
max-batch-age
|
max-batch-age
|
||||||
|
buffer-size
|
||||||
init]
|
init]
|
||||||
:or {max-batch-size 200
|
:or {max-batch-size 200
|
||||||
max-batch-age (* 30 1000)
|
max-batch-age (* 30 1000)
|
||||||
|
buffer-size 128
|
||||||
init #{}}
|
init #{}}
|
||||||
:as opts}]
|
:as opts}]
|
||||||
(let [out (a/chan)]
|
(let [out (a/chan buffer-size)]
|
||||||
(a/go-loop [tch (a/timeout max-batch-age) buf init]
|
(a/go-loop [tch (a/timeout max-batch-age) buf init]
|
||||||
(let [[val port] (a/alts! [tch in])]
|
(let [[val port] (a/alts! [tch in])]
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Add table
Reference in a new issue