Skip to content

Commit 22ddb40

Browse files
committed
fix: modified code to use flush() when internal queue is not loaded
https://telecominfraproject.atlassian.net/browse/WIFI-13857 NOTE: This is port of Telecominfraproject/wlan-cloud-ucentralgw#362 Signed-off-by: Ivan Chvets <ivan.chvets@kinarasystems.com>
1 parent 46b9524 commit 22ddb40

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/framework/KafkaManager.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,16 @@ namespace OpenWifi {
107107
NewMessage.partition(0);
108108
NewMessage.payload(Msg->Payload());
109109
Producer.produce(NewMessage);
110-
Producer.poll((std::chrono::milliseconds) 0);
110+
if (Queue_.size() < 100) {
111+
// use flush when internal queue is lightly loaded, i.e. flush after each
112+
// message
113+
Producer.flush();
114+
}
115+
else {
116+
// use poll when internal queue is loaded to allow messages to be sent in
117+
// batches
118+
Producer.poll((std::chrono::milliseconds) 0);
119+
}
111120
}
112121
} catch (const cppkafka::HandleException &E) {
113122
poco_warning(Logger_,

0 commit comments

Comments
 (0)