Skip to content

Commit a16cd70

Browse files
jeroenvisser101josevalim
authored andcommitted
Fix type for subscription_options (#226)
It seems like the name suggested it was a keyword list, but instead it defined a single option. This confusion carried on into the spec for `handle_subscribe` where the typespec defined the `opts` argument as a tuple instead of a keyword list. I opted for redefining the existing reference to this type since it might be used outside as to not introduce any breaking changes. If this isn't required, I'm open to renaming the existing type to subscription_option and changing the existing spec to be a list of tuples instead of a single tuple.
1 parent 77485c8 commit a16cd70

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/gen_stage.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,12 +769,15 @@ defmodule GenStage do
769769
@typedoc "The supported stage types."
770770
@type type :: :producer | :consumer | :producer_consumer
771771

772-
@typedoc "Options used by the `subscribe*` functions"
773-
@type subscription_options ::
772+
@typedoc "Option used by the `subscribe*` functions"
773+
@type subscription_option ::
774774
{:cancel, :permanent | :transient | :temporary}
775775
| {:min_demand, integer}
776776
| {:max_demand, integer}
777777

778+
@typedoc "Options used by the `subscribe*` functions"
779+
@type subscription_options :: [subscription_option()]
780+
778781
@typedoc "Option values used by the `init*` specific to `:producer` type"
779782
@type producer_only_option :: {:demand, :forward | :accumulate}
780783

0 commit comments

Comments
 (0)