Make Carmine appender resistant to unexpected thaw errors

This commit is contained in:
Peter Taoussanis 2014-02-09 19:02:03 +07:00
parent 4a5c4ccce4
commit 87af0d40cc
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,7 @@
## Pending major release
* Make Carmine appender resistant to unexpected log entry thaw errors.
## v3.0.0 / 2014-Jan-30 ## v3.0.0 / 2014-Jan-30
Major update, non-breaking though users with custom appenders are encouraged to view the _Changes_ section below. This version polishes up the codebase and general design. Tightened up a few aspects of how appenders and appender middleware work. Added a serializing Carmine appender (I use something similar in prod most of the time). Also finally added facilities for ad hoc (non-atom) logging configuration. Major update, non-breaking though users with custom appenders are encouraged to view the _Changes_ section below. This version polishes up the codebase and general design. Tightened up a few aspects of how appenders and appender middleware work. Added a serializing Carmine appender (I use something similar in prod most of the time). Also finally added facilities for ad hoc (non-atom) logging configuration.

View File

@ -107,13 +107,18 @@
:hash entry-hash})) :hash entry-hash}))
[])) []))
entries-hash ; [{_} {_} ...] entries-hash ; [{_}-or-ex {_}-or-ex ...]
(when-let [hashes (seq (mapv :hash entries-zset))] (when-let [hashes (seq (mapv :hash entries-zset))]
(if-not (next hashes) (if-not (next hashes)
[(car/wcar conn (apply car/hget k-hash hashes))] ; Careful! (car/wcar conn :as-pipeline (apply car/hget k-hash hashes)) ; Careful!
(car/wcar conn (apply car/hmget k-hash hashes))))] (car/wcar conn (apply car/hmget k-hash hashes))))]
(mapv (fn [m1 m2] (-> (merge m1 m2) (dissoc :hash))) (mapv (fn [m1 m2-or-ex]
(if (instance? Exception m2-or-ex)
;; Should be rare but can happen (e.g. due to faulty Nippy
;; extensions or inconsistently-unserializable args):
(-> (assoc m1 :entry-ex m2-or-ex) (dissoc :hash))
(-> (merge m1 m2-or-ex) (dissoc :hash))))
entries-zset entries-hash))) entries-zset entries-hash)))
;;;; Dev/tests ;;;; Dev/tests