dogstatsd-elixir icon indicating copy to clipboard operation
dogstatsd-elixir copied to clipboard

Return the value from the function in batch/2

Open zorbash opened this issue 6 years ago • 0 comments

Since batch/2 is intended to buffer requests, returning the return value of the passed function can be handy in use cases like the example below, where we care for the return value.

map = DogStatsd.batch statsd, fn (statsd) ->
  for i <- 1..10_000, into: %{}, do 
    s.increment(statsd, "numbers")
    {"key_#{i}", i}
  end
end

some_function(map)

zorbash avatar Mar 16 '18 16:03 zorbash