Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 committed Nov 7, 2023
1 parent 9bad4cf commit 1f4768f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ namespace {
const double k_WATERMARK_RATIO = 0.8;
// Percentage of the 'capacity' to use for the 'lowWatermark'

const int k_MAX_INSTANT_MESSAGES = 10;
// Maximum messages logged with throttling in a short period of time.

const bsls::Types::Int64 k_NS_PER_MESSAGE =
bdlt::TimeUnitRatio::k_NANOSECONDS_PER_SECOND;
// Time interval between messages logged with throttling.

typedef bsl::function<void()> CompletionCallback;

/// Utility function used in `mwcu::OperationChain` as the operation
Expand Down Expand Up @@ -606,9 +613,6 @@ void QueueHandle::registerSubscription(unsigned int downstreamSubId,
const bmqp_ctrlmsg::ConsumerInfo& ci,
unsigned int upstreamId)
{
static const int k_MAX_INSTANT_MESSAGES = 10;
static const bsls::Types::Int64 k_NS_PER_MESSAGE =
bdlt::TimeUnitRatio::k_NANOSECONDS_PER_SECOND;
BALL_LOGTHROTTLE_INFO(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE)
<< "QueueHandle [" << this
<< "] registering Subscription [id = " << downstreamId
Expand Down Expand Up @@ -715,9 +719,6 @@ bool QueueHandle::unregisterSubStream(
itSubscription != d_subscriptions.end();) {
const SubscriptionSp& subscription = itSubscription->second;
if (subscription->d_downstreamSubQueueId == downstreamSubQueueId) {
static const int k_MAX_INSTANT_MESSAGES = 10;
static const bsls::Types::Int64 k_NS_PER_MESSAGE =
bdlt::TimeUnitRatio::k_NANOSECONDS_PER_SECOND;
BALL_LOGTHROTTLE_INFO(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE)
<< "Queue '" << d_queue_sp->description() << "' handle "
<< this << " removing Subscription "
Expand Down
12 changes: 10 additions & 2 deletions src/groups/mqb/mqbblp/mqbblp_relayqueueengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <mwcu_weakmemfn.h>

// BDE
#include <ball_logthrottle.h>
#include <bdlb_print.h>
#include <bdlb_scopeexit.h>
#include <bdlf_bind.h>
Expand All @@ -66,6 +67,13 @@ namespace mqbblp {

namespace {

const int k_MAX_INSTANT_MESSAGES = 10;
// Maximum messages logged with throttling in a short period of time.

const bsls::Types::Int64 k_NS_PER_MESSAGE =
bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MINUTE / k_MAX_INSTANT_MESSAGES;
// Time interval between messages logged with throttling.

// ====================
// class LimitedPrinter
// ====================
Expand Down Expand Up @@ -286,7 +294,7 @@ void RelayQueueEngine::onHandleConfiguredDispatched(
<< downStreamParameters << ", but assuming success.";
}

BALL_LOG_DEBUG_BLOCK
BALL_LOGTHROTTLE_INFO_BLOCK(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE)
{
mqbcmd::RoundRobinRouter outrr(d_allocator_p);
context->d_routing_sp->loadInternals(&outrr);
Expand Down Expand Up @@ -319,7 +327,7 @@ void RelayQueueEngine::onHandleConfiguredDispatched(
applyConfiguration(app, *context);
}

BALL_LOG_DEBUG_BLOCK
BALL_LOGTHROTTLE_INFO_BLOCK(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE)
{
mqbcmd::QueueEngine outqe(d_allocator_p);
loadInternals(&outqe);
Expand Down

0 comments on commit 1f4768f

Please sign in to comment.