Skip to content

Commit

Permalink
Cancel pending async callback before resetting client and evb
Browse files Browse the repository at this point in the history
  • Loading branch information
yuandagits committed Dec 30, 2024
1 parent 90f941d commit d97c0ec
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ void PeriodicServiceInventoryManager::start() {

void PeriodicServiceInventoryManager::stop() {
stopped_ = true;
client_.reset();
eventBaseThread_.stop();
// Simply cancel libevent timeout callback before calling reset on the client
// first. This is to ensure that the client is not destroyed while there is a
// pending request.
LOG(INFO) << fmt::format(
"Cancelled :{} async events in PeriodicServiceInventoryManager",
eventBaseThread_.getEventBase()->timer().cancelAll());
}

void PeriodicServiceInventoryManager::setDetails(const std::string& details) {
Expand Down

0 comments on commit d97c0ec

Please sign in to comment.