Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit 5 instead of raising error if no etcd endpoint responds #886

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/etcd_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe LavinMQ::Etcd do
etcd.watch("foo") do |val|
w.send val
end
rescue LavinMQ::Etcd::Error
rescue SpecExit
# expect this when etcd nodes are terminated
end
w.receive # sync
Expand All @@ -51,15 +51,15 @@ describe LavinMQ::Etcd do
etcd.elect_listen(key) do |value|
leader.send value
end
rescue LavinMQ::Etcd::Error
rescue SpecExit
# expect this when etcd nodes are terminated
end
lease = etcd.elect(key, "bar", 1)
leader.receive.should eq "bar"
spawn(name: "elect other leader spec") do
begin
etcd.elect(key, "bar2", 1)
rescue LavinMQ::Etcd::Error
rescue SpecExit
# expect this when etcd nodes are terminated
end
end
Expand Down
3 changes: 2 additions & 1 deletion src/lavinmq/etcd.cr
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ module LavinMQ
Log.debug { "Could not connect to #{address}: #{ex}" }
next
end
raise Error.new("No endpoint responded")
Log.fatal { "No etcd endpoint responded" }
exit 5 # 5th character in the alphabet is E(etcd)
end

private def update_endpoints(tcp, address)
Expand Down
Loading