(ws cobra to sentry/statsd) fix for handling null events properly for empty queues + use queue to send data to statsd

This commit is contained in:
Benjamin Sergeant
2019-12-28 17:28:05 -08:00
parent f4af84dc06
commit 299dc0452e
4 changed files with 126 additions and 33 deletions

View File

@ -22,7 +22,10 @@ namespace ix
class QueueManager
{
public:
QueueManager(size_t maxQueueSize, std::atomic<bool> &stop) : _maxQueueSize(maxQueueSize), _stop(stop) {}
QueueManager(size_t maxQueueSize,
std::atomic<bool> &stop) :
_maxQueueSize(maxQueueSize),
_stop(stop) {}
Json::Value pop();
void add(Json::Value msg);
@ -146,11 +149,7 @@ namespace ix
{
Json::Value msg = queueManager.pop();
while (msg.isNull())
{
msg = queueManager.pop();
if (stop) return;
}
if (msg.isNull()) continue;
if (stop) return;
auto ret = sentryClient.send(msg, verbose);