Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun committed Jan 15, 2025
1 parent f8fb16d commit 04e4552
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lavinmq/clustering/controller.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class LavinMQ::Clustering::Controller
"tcp://#{System.hostname}:#{@config.clustering_port}"
end

# This method is called by the Launcher#run.
# The block will be yielded when the controller's prerequisites for a leader
# to start are met, i.e when the current node has been elected leader.
# The method is blocking.
def run(&)
spawn(follow_leader, name: "Follower monitor")
wait_to_be_insync
Expand Down
3 changes: 3 additions & 0 deletions src/lavinmq/launcher.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ require "./clustering/controller"

module LavinMQ
struct StandaloneRunner
# The block will be yielded when the runner's prerequisites for a leader
# to start are met. For the standalone runner, this is immediately.
# The method is blocking.
def run(&)
yield
loop do
Expand Down

0 comments on commit 04e4552

Please sign in to comment.