Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
unroll producer result decode loop
Browse files Browse the repository at this point in the history
  • Loading branch information
eulerfx committed Jul 14, 2017
1 parent 36ded55 commit 32d17fc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/kafunk/Producer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,14 @@ module Producer =
|> Option.iter (fun res -> IVar.tryPut res b.rep |> ignore)

if oks.Length > 0 then
let oks =
oks
|> Seq.map (fun (p,o) ->
let pmc = ps.[p].Count
p, Success (ProducerResult(p,o,pmc)))
|> Dict.ofSeq
let oks' = Dict.empty
for i = 0 to oks.Length - 1 do
let p,o = oks.[i] in
let pmc = ps.[p].Count in
oks'.[p] <- Success (ProducerResult(p,o,pmc))
for b in batch do
let mutable res = Unchecked.defaultof<_>
if (oks.TryGetValue(b.partition, &res)) then
if (oks'.TryGetValue(b.partition, &res)) then
IVar.tryPut res b.rep |> ignore

| Failure errs ->
Expand Down

0 comments on commit 32d17fc

Please sign in to comment.