Carmine appender: fix entry hash fetching for empty level logs

This commit is contained in:
Peter Taoussanis 2013-12-02 16:55:39 +07:00
parent a547674bc2
commit 23d7b775c2
1 changed files with 4 additions and 1 deletions

View File

@ -106,7 +106,10 @@
[]))
entries-hash ; [{_} {_} ...]
(car/wcar conn (apply car/hmget k-hash (mapv :hash entries-zset)))]
(when-let [hashes (seq (mapv :hash entries-zset))]
(if-not (next hashes)
[(car/wcar conn (apply car/hget k-hash hashes))] ; Careful!
(car/wcar conn (apply car/hmget k-hash hashes))))]
(mapv (fn [m1 m2] (-> (merge m1 m2) (dissoc :hash)))
entries-zset entries-hash)))