diff --git a/extras/config.ini b/extras/config.ini index 04b0926176..5a64646b94 100644 --- a/extras/config.ini +++ b/extras/config.ini @@ -22,5 +22,3 @@ tcp_proxy_protocol = false tls_port = 5671 unix_path = /tmp/lavinmq.sock unix_proxy_protocol = true -min_followers = 1 -max_lag = 10000 diff --git a/src/lavinmq/replication/server.cr b/src/lavinmq/replication/server.cr index 8d0b9e7dd2..54a5a7bff2 100644 --- a/src/lavinmq/replication/server.cr +++ b/src/lavinmq/replication/server.cr @@ -103,11 +103,10 @@ module LavinMQ select when @wait_for_followers.receive when timeout(1.seconds) - pp "Followers: #{@followers.size}" end end - #TODO: only start looping for max_lag for the amount min_followers - @followers.each do |f| + @followers.each_with_index do |f, i| + break if i > Config.instance.min_followers f.wait_for_max_lag end end @@ -240,15 +239,11 @@ module LavinMQ if max_lag = Config.instance.max_lag current_lag = lag until current_lag < max_lag - pp "blocking: #{current_lag}" select when timeout(1.seconds) - pp lag when current_lag = @ack.receive end - pp "unblocking" - #TODO: break if THIS follower disconnects - break if @server.followers.size < Config.instance.min_followers + break if @server.followers.includes?(self) == false end end end