Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

amqp shutdown hang #10111

Merged
merged 1 commit into from
Mar 5, 2021
Merged
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
12 changes: 10 additions & 2 deletions libraries/amqp/include/eosio/amqp/amqp_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,18 @@ class amqp {
std::promise<void> stop_promise;
auto future = stop_promise.get_future();
boost::asio::post( *handler_->amqp_strand(), [&]() {
if( channel_ ) {
if( channel_ && channel_->usable() ) {
auto& cb = channel_->close();
cb.onFinalize( [&]() {
stop_promise.set_value();
try {
stop_promise.set_value();
} catch(...) {}
swatanabe-b1 marked this conversation as resolved.
Show resolved Hide resolved
} );
cb.onError( [&](const char* message) {
elog( "Error on stop: ${m}", ("m", message) );
try {
stop_promise.set_value();
} catch(...) {}
} );
} else {
stop_promise.set_value();
Expand Down