Carmine appender: better handling when logging unfreezable args (needs Nippy v2.5.1+)

This commit is contained in:
Peter Taoussanis 2013-12-03 16:51:07 +07:00
parent 38d1c81dd1
commit 2c53586e65
2 changed files with 4 additions and 1 deletions

View File

@ -11,6 +11,7 @@
:1.6 {:dependencies [[org.clojure/clojure "1.6.0-alpha2"]]} :1.6 {:dependencies [[org.clojure/clojure "1.6.0-alpha2"]]}
:dev {:dependencies [[com.draines/postal "1.11.1"] :dev {:dependencies [[com.draines/postal "1.11.1"]
[com.taoensso/carmine "2.4.0"] [com.taoensso/carmine "2.4.0"]
[com.taoensso/nippy "2.5.1"] ; nb .1
[org.clojure/tools.logging "0.2.6"]]} [org.clojure/tools.logging "0.2.6"]]}
:test {:dependencies [[expectations "1.4.56"]]}} :test {:dependencies [[expectations "1.4.56"]]}}
:aliases {"test-all" ["with-profile" "+test,+1.4:+test,+1.5:+test,+1.6" "expectations"] :aliases {"test-all" ["with-profile" "+test,+1.4:+test,+1.5:+test,+1.6" "expectations"]

View File

@ -2,6 +2,7 @@
"Carmine (Redis) appender. Requires https://github.com/ptaoussanis/carmine." "Carmine (Redis) appender. Requires https://github.com/ptaoussanis/carmine."
{:author "Peter Taoussanis"} {:author "Peter Taoussanis"}
(:require [taoensso.carmine :as car] (:require [taoensso.carmine :as car]
[taoensso.nippy :as nippy]
[taoensso.timbre :as timbre])) [taoensso.timbre :as timbre]))
(defn- sha48 (defn- sha48
@ -58,7 +59,8 @@
(when (> nmax-entries 0) (when (> nmax-entries 0)
(car/wcar conn (car/wcar conn
(car/hset k-hash entry-hash entry) (binding [nippy/*final-freeze-fallback* nippy/freeze-fallback-as-str]
(car/hset k-hash entry-hash entry))
(car/zadd k-zset udt entry-hash) (car/zadd k-zset udt entry-hash)
(when (< (rand) 0.01) ; Occasionally GC (when (< (rand) 0.01) ; Occasionally GC