batch
|> Enum.slice(last_batch, chunk)
|> Enum.each(fn {_k, _v} = v ->
- :ets.insert(db, v)
+ :ets.insert_new(db, v)
# do_upsert(db, k, v, fun)
end)
end
def handle_info({:get_key, key, ref, node}, _, %SL{data: %Ring{name: n, db: db, node: me}} = sl) do
+ Logger.info("Getting value for #{inspect(key)} with ref #{inspect(ref)}")
send({n, node}, {:reply, get_key(db, key), ref, me})
{:ok, sl, []}
end
end
def handle_info({:reply, val, ref, from}, _, %SL{data: %Ring{requests: reqs} = data} = sl) do
+ Logger.info("Got #{inspect(val)} with ref #{inspect(ref)}")
{requests, actions} = maybe_reply(ref, reqs, val, from)
{:ok, %SL{sl | data: %Ring{data | requests: requests}}, actions}
end