Skip to content

Commit

Permalink
Rename concurrency option to be compatible with Commanded 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosestito committed Jul 6, 2022
1 parent 0a930fd commit e8faff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/commanded/event_store/adapters/spear/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Commanded.EventStore.Adapters.Spear.Subscription do
:serializer,
:stream,
:start_from,
:subscriber_max_count,
:concurrency_limit,
:subscriber,
:subscriber_ref,
:subscription,
Expand All @@ -38,7 +38,7 @@ defmodule Commanded.EventStore.Adapters.Spear.Subscription do
serializer: serializer,
subscriber: subscriber,
start_from: Keyword.get(opts, :start_from),
subscriber_max_count: Keyword.get(opts, :subscriber_max_count, 1),
concurrency_limit: Keyword.get(opts, :concurrency_limit, 1),
retry_interval: subscription_retry_interval()
}

Expand Down Expand Up @@ -168,11 +168,11 @@ defmodule Commanded.EventStore.Adapters.Spear.Subscription do
name: name,
stream: stream,
start_from: start_from,
subscriber_max_count: subscriber_max_count
concurrency_limit: concurrency_limit
} = state

settings = %Spear.PersistentSubscription.Settings{
max_subscriber_count: subscriber_max_count,
max_subscriber_count: concurrency_limit,
message_timeout: 10_000,
resolve_links?: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ defmodule Commanded.EventStore.Adapters.Spear.SubscriptionsSupervisor do
{:ok, pid}

{:error, {:already_started, _pid}} ->
case Keyword.get(opts, :subscriber_max_count) do
case Keyword.get(opts, :concurrency_limit) do
nil ->
{:error, :subscription_already_exists}

subscriber_max_count when index < subscriber_max_count - 1 ->
concurrency_limit when index < concurrency_limit - 1 ->
start_subscription(
event_store,
conn,
Expand Down

0 comments on commit e8faff2

Please sign in to comment.