Skip to content

Commit

Permalink
Merge pull request #228 from rabbitmq/md-use-cached-leader-for-async-…
Browse files Browse the repository at this point in the history
…commands

khepri_machine: Use cached leader for async commands
  • Loading branch information
dumbbell authored Oct 11, 2023
2 parents 8a75f9d + e503414 commit ae50ffd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/khepri_machine.erl
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,9 @@ process_sync_command(StoreId, Command, Options) ->
end.

process_async_command(StoreId, Command, Correlation, Priority) ->
LocalServerId = {StoreId, node()},
ra:pipeline_command(LocalServerId, Command, Correlation, Priority).
LeaderId = khepri_cluster:get_cached_leader(StoreId),
RaServer = use_leader_or_local_ra_server(StoreId, LeaderId),
ra:pipeline_command(RaServer, Command, Correlation, Priority).

-spec select_command_type(Options) -> CommandType when
Options :: khepri:command_options(),
Expand Down

0 comments on commit ae50ffd

Please sign in to comment.