From: Christopher Coté Date: Wed, 27 Jan 2021 21:06:15 +0000 (-0600) Subject: update batch upsert function X-Git-Url: http://git.entropealabs.com/?a=commitdiff_plain;h=549799a86f1852717f10c85a27cb44d8786c34d7;p=cluster_kv.git update batch upsert function --- diff --git a/lib/cluster_kv/db.ex b/lib/cluster_kv/db.ex index 734e70c..b0301b9 100644 --- a/lib/cluster_kv/db.ex +++ b/lib/cluster_kv/db.ex @@ -73,7 +73,7 @@ defmodule ClusterKV.DB do chunk :: integer(), fun :: update_function() ) :: :ok - def batch(name, batch, chunk \\ 10, fun \\ &{elem(&1, 0), Enum.uniq([elem(&1, 1) | &2])}) do + def batch(name, batch, chunk \\ 10, fun \\ &{elem(&1, 0), Enum.uniq(elem(&1, 1) ++ &2)}) do :poolboy.transaction(name, fn w -> GenServer.cast(w, {:batch, batch, chunk, fun}) end)