Skip to content

Commit

Permalink
fix: update code to improve exception handling
Browse files Browse the repository at this point in the history
https://telecominfraproject.atlassian.net/browse/WIFI-14038

Summary of changes:
- Modified code to cover zero sized queues under exception handling.

Signed-off-by: Ivan Chvets <[email protected]>
  • Loading branch information
i-chvets committed Aug 29, 2024
1 parent 783ec99 commit 9c5aeda
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 9c5aeda

Please sign in to comment.