Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update queue stats on response (not only on request) #363

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/groups/mqb/mqbblp/mqbblp_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ void Queue::convertToLocalDispatched()

void Queue::updateStats()
{
d_state.stats()
.setReaderCount(d_state.handleParameters().readCount())
.setWriterCount(d_state.handleParameters().writeCount());
d_state.updateStats();
}

void Queue::listMessagesDispatched(mqbcmd::QueueResult* result,
Expand Down
7 changes: 7 additions & 0 deletions src/groups/mqb/mqbblp/mqbblp_queuestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ QueueState::subtract(const bmqp_ctrlmsg::QueueHandleParameters& params)
return mqbi::QueueCounts(it->second.readCount(), it->second.writeCount());
}

void QueueState::updateStats()
{
stats()
.setReaderCount(handleParameters().readCount())
.setWriterCount(handleParameters().writeCount());
}

mqbi::QueueCounts QueueState::consumerAndProducerCounts(
const bmqp_ctrlmsg::QueueHandleParameters& params) const
{
Expand Down
3 changes: 3 additions & 0 deletions src/groups/mqb/mqbblp/mqbblp_queuestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ class QueueState {
/// Return reference to the structures for the queue engine routing.
Routers::QueueRoutingContext& routingContext();

/// Update the stats to the current values in the handleParamaters
void updateStats();

// ACCESSORS

/// Return true if the queue has upstream parameters for the specified
Expand Down
2 changes: 2 additions & 0 deletions src/groups/mqb/mqbblp/mqbblp_remotequeue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ void RemoteQueue::onHandleReleased(
BSLS_ASSERT_SAFE(d_state_p->queue()->dispatcher()->inDispatcherThread(
d_state_p->queue()));

d_state_p->updateStats();

mqbi::Cluster* cluster = d_state_p->domain()->cluster();
if (result.hasNoHandleStreamConsumers()) {
// Lost last reader for the specified subStream for the handle
Expand Down
Loading