jbertram commented on code in PR #5334:
URL: https://github.com/apache/activemq-artemis/pull/5334#discussion_r1857060527


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java:
##########
@@ -1366,17 +1367,32 @@ private static void applyExpiryDelay(Message message, 
AddressSettings settings)
             message.setExpiration(System.currentTimeMillis() + 
expirationOverride);
          }
       } else {
-         long minExpiration = settings.getMinExpiryDelay();
-         long maxExpiration = settings.getMaxExpiryDelay();
-
-         if (maxExpiration != AddressSettings.DEFAULT_MAX_EXPIRY_DELAY && 
(message.getExpiration() == 0 || message.getExpiration() > 
(System.currentTimeMillis() + maxExpiration))) {
-            message.setExpiration(System.currentTimeMillis() + maxExpiration);
+         // if the incoming message has NO expiration then apply the max if 
set and if not set then apply the min if set
+         if (message.getExpiration() == 0) {
+            if (maxExpiration != AddressSettings.DEFAULT_MAX_EXPIRY_DELAY && 
maxExpiration != 0) {
+               message.setExpiration(getExpirationToSet(maxExpiration));
+            } else if (minExpiration != 
AddressSettings.DEFAULT_MIN_EXPIRY_DELAY && minExpiration != 0) {
+               message.setExpiration(getExpirationToSet(minExpiration));
+            }

Review Comment:
   Done.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to