gemmellr commented on code in PR #4749:
URL: https://github.com/apache/activemq-artemis/pull/4749#discussion_r1457248264
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
##########
@@ -2357,11 +2357,20 @@ public synchronized RoutingStatus doSend(final
Transaction tx,
routingContext.setAddress(art.getName());
routingContext.setRoutingType(art.getRoutingType());
+ int lmSize = 0;
+ if (msg instanceof LargeServerMessageImpl) {
+ // before routing large messages,
+ // prefetch its body size for updating
+ // producer metrics after message being routed
+ // because after route the large messages backing file
+ // may be closed quickly with acks from clients
+ lmSize = ((LargeServerMessageImpl)msg).getBodyBufferSize();
+ }
Review Comment:
Rather than only passing the size for large messages, seems like it would be
nicer if it assessed the size for either type here and then always pass it to
the update. That way the existing check that was previously done later can just
be moved here (i.e do same work, just in different place) rather than needing
to repeat the check.
The comment can then perhaps also just be summarised a bit, e.g "Retrieve
message size for metrics update before routing, since large message backing
files may be closed once routing completes"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]