Skip to content

Commit 966ddd3

Browse files
authored
Merge pull request #115 from Telecominfraproject/fix_improve_exeception_handling
Exception handling improvement.
2 parents b98dd45 + 2781342 commit 966ddd3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/framework/KafkaManager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ namespace OpenWifi {
118118
Producer.poll((std::chrono::milliseconds) 0);
119119
}
120120
}
121+
if (Queue_.size() == 0) {
122+
// message queue is empty, flush all previously sent messages
123+
Producer.flush();
124+
}
121125
} catch (const cppkafka::HandleException &E) {
122126
poco_warning(Logger_,
123127
fmt::format("Caught a Kafka exception (producer): {}", E.what()));
@@ -126,10 +130,6 @@ namespace OpenWifi {
126130
} catch (...) {
127131
poco_error(Logger_, "std::exception");
128132
}
129-
if (Queue_.size() == 0) {
130-
// message queue is empty, flush all previously sent messages
131-
Producer.flush();
132-
}
133133
Note = Queue_.waitDequeueNotification();
134134
}
135135
Producer.flush();

0 commit comments

Comments
 (0)