Skip to content

Commit 6249cb9

Browse files
authored
Merge pull request #59 from Telecominfraproject/WIFI-13857-fix-svc-kafka-startup
WIFI-13857: fix: modified code to use flush() when internal queue is not loaded
2 parents a88014d + 574ea60 commit 6249cb9

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)