Skip to content

Commit 6fd331f

Browse files
teamonjosevalim
authored andcommitted
Update PartitionDispatcher docs (#204) (#209)
1 parent 3236449 commit 6fd331f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/gen_stage/partition_dispatcher.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ defmodule GenStage.PartitionDispatcher do
2020
named `:odd` and `:even`.
2121
2222
* `:hash` - the hashing algorithm, which receives the event and returns
23-
a tuple with two elements, containing the event and the partition.
24-
The partition must be one of the partitions specified in `:partitions`
25-
above. The default uses `&:erlang.phash2(&1, Enum.count(partitions))`
23+
a tuple with two elements, the event to be dispatched as first argument
24+
and the partition as second. The partition must be one of the partitions
25+
specified in `:partitions` above. The default uses
26+
`fn event -> {event, :erlang.phash2(event, Enum.count(partitions))} end`
2627
on the event to select the partition.
2728
2829
### Examples

0 commit comments

Comments
 (0)