diff --git a/CHANGELOG.md b/CHANGELOG.md index 1765e1b..54cb7e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ +## v3.1.2 / 2014 Mar 9 + + * FIX: Carmine appender unfreezable support for Carmine v3+. + + ## v3.1.1 / 2014 Feb 26 -### Fixes - - * Fix project.clj to prevent unnecessary downstream deps. + * FIX: project.clj to prevent unnecessary downstream deps. ## v3.1.0 / 2014 Feb 23 diff --git a/src/taoensso/timbre/appenders/carmine.clj b/src/taoensso/timbre/appenders/carmine.clj index 650e94f..c8a7c14 100644 --- a/src/taoensso/timbre/appenders/carmine.clj +++ b/src/taoensso/timbre/appenders/carmine.clj @@ -59,29 +59,30 @@ nmax-entries (nentries-by-level level)] (when (> nmax-entries 0) - (car/wcar (or conn-opts (:conn opts)) ; :conn is Deprecated - (binding [nippy/*final-freeze-fallback* nippy/freeze-fallback-as-str] - (car/hset k-hash entry-hash entry)) - (car/zadd k-zset udt entry-hash) + (binding [nippy/*final-freeze-fallback* nippy/freeze-fallback-as-str] + (car/wcar (or conn-opts (:conn opts)) ; :conn is Deprecated - (when (< (rand) 0.01) ; Occasionally GC - ;; This is necessary since we're doing zset->entry-hash->entry - ;; rather than zset->entry. We want the former for the control - ;; it gives us over what should constitute a 'unique' entry. - (car/lua - "-- -ive idx used to prune from the right (lowest score first) - local max_idx = (0 - (tonumber(_:nmax-entries)) - 1) - local entries_to_prune = - redis.call('zrange', _:k-zset, 0, max_idx) - redis.call('zremrangebyrank', _:k-zset, 0, max_idx) -- Prune zset + (car/hset k-hash entry-hash entry) + (car/zadd k-zset udt entry-hash) - for i,entry in pairs(entries_to_prune) do - redis.call('hdel', _:k-hash, entry) -- Prune hash - end - return nil" - {:k-zset k-zset - :k-hash k-hash} - {:nmax-entries nmax-entries}))))))}))) + (when (< (rand) 0.01) ; Occasionally GC + ;; This is necessary since we're doing zset->entry-hash->entry + ;; rather than zset->entry. We want the former for the control + ;; it gives us over what should constitute a 'unique' entry. + (car/lua + "-- -ive idx used to prune from the right (lowest score first) + local max_idx = (0 - (tonumber(_:nmax-entries)) - 1) + local entries_to_prune = + redis.call('zrange', _:k-zset, 0, max_idx) + redis.call('zremrangebyrank', _:k-zset, 0, max_idx) -- Prune zset + + for i,entry in pairs(entries_to_prune) do + redis.call('hdel', _:k-hash, entry) -- Prune hash + end + return nil" + {:k-zset k-zset + :k-hash k-hash} + {:nmax-entries nmax-entries})))))))}))) ;;;; Query utils