Skip to content

Commit

Permalink
Revert "Raise on fatal errors instead of exit"
Browse files Browse the repository at this point in the history
This reverts commit 4911532.
  • Loading branch information
viktorerlingsson committed Jan 14, 2025
1 parent 5d15f87 commit cdfdbee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 4 additions & 8 deletions src/lavinmq.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ config.parse # both ARGV and config file
require "./lavinmq/launcher"
require "./lavinmq/clustering/controller"

begin
if config.clustering?
LavinMQ::Clustering::Controller.new(config).run
else
LavinMQ::Launcher.new(config).run
end
rescue LavinMQ::Etcd::NoEtcdEndpoint
exit 5 # 5th character in the alphabet is E(etcd)
if config.clustering?
LavinMQ::Clustering::Controller.new(config).run
else
LavinMQ::Launcher.new(config).run
end
4 changes: 1 addition & 3 deletions src/lavinmq/etcd.cr
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ module LavinMQ
end
end

class NoEtcdEndpoint < Exception; end

private def connect : Tuple(TCPSocket, String)
@endpoints.shuffle!.each do |address|
host, port = address.split(':', 2)
Expand All @@ -300,7 +298,7 @@ module LavinMQ
next
end
Log.fatal { "No etcd endpoint responded" }
raise NoEtcdEndpoint.new
exit 5 # 5th character in the alphabet is E(etcd)
end

private def update_endpoints(tcp, address)
Expand Down

0 comments on commit cdfdbee

Please sign in to comment.