Skip to content

Commit

Permalink
extract lock object outside function
Browse files Browse the repository at this point in the history
  • Loading branch information
ericdallo committed Jan 31, 2021
1 parent c429e77 commit c8d3a52
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/taoensso/timbre/appenders/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@

(have? enc/nblank-str? fname)

{:enabled? true
:fn
(fn self [data]
(if locking?
(locking (Object.)
(write-to-file data fname append? self))
(write-to-file data fname append? self)))}))
(let [lock (Object.)]
{:enabled? true
:fn
(fn self [data]
(if locking?
(locking lock
(write-to-file data fname append? self))
(write-to-file data fname append? self)))})))

(comment
(spit-appender)
Expand Down

0 comments on commit c8d3a52

Please sign in to comment.