{:noreply, %DB{state | batch: batch, last_batch: lb}}
end
- defp handle_next_batch_chunk(db, batch, chunk, last_batch, fun) do
- batch
- |> Enum.slice(last_batch, chunk)
- |> Enum.each(fn {k, v} ->
+ defp handle_next_batch_chunk(db, batch, _chunk, _last_batch, fun) do
+ Enum.each(batch, fn {k, v} ->
do_upsert(db, k, v, fun)
end)
- case last_batch + chunk do
- lb when lb > length(batch) ->
- {[], 0}
-
- lb ->
- Process.send_after(self(), :process_batch, 0)
- {batch, lb}
- end
+ {[], 0}
+ # batch
+ # |> Enum.slice(last_batch, chunk)
+ # |> Enum.each(fn {k, v} ->
+ # do_upsert(db, k, v, fun)
+ # end)
+
+ # case last_batch + chunk do
+ # lb when lb > length(batch) ->
+ # {[], 0}
+ #
+ # lb ->
+ # Process.send_after(self(), :process_batch, 0)
+ # {batch, lb}
+ # end
end
defp do_upsert(db, key, value, fun) do