Skip to content

Commit

Permalink
Merge pull request #371 from Telecominfraproject/WIFI-14038-fix-excep…
Browse files Browse the repository at this point in the history
…tion-handling-for-zero-queue

WIFI-14038: fix: update code to improve exception handling
  • Loading branch information
i-chvets authored Sep 10, 2024
2 parents 783ec99 + 9c5aeda commit 3114ff8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/framework/KafkaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ namespace OpenWifi {
Producer.poll((std::chrono::milliseconds) 0);
}
}
if (Queue_.size() == 0) {
// message queue is empty, flush all previously sent messages
Producer.flush();
}
} catch (const cppkafka::HandleException &E) {
poco_warning(Logger_,
fmt::format("Caught a Kafka exception (producer): {}", E.what()));
Expand All @@ -126,10 +130,6 @@ namespace OpenWifi {
} catch (...) {
poco_error(Logger_, "std::exception");
}
if (Queue_.size() == 0) {
// message queue is empty, flush all previously sent messages
Producer.flush();
}
Note = Queue_.waitDequeueNotification();
}
Producer.flush();
Expand Down

0 comments on commit 3114ff8

Please sign in to comment.