Control inbound message byte limits with a dynamic configuration flag

This commit is contained in:
Jon Chambers
2023-07-14 15:26:04 -04:00
committed by Jon Chambers
parent e87468fbe0
commit b8d8d349f4
4 changed files with 31 additions and 1 deletions

View File

@@ -226,7 +226,13 @@ public class MessageController {
totalContentLength += contentLength;
}
rateLimiters.getInboundMessageBytes().validate(destinationUuid, totalContentLength);
try {
rateLimiters.getInboundMessageBytes().validate(destinationUuid, totalContentLength);
} catch (final RateLimitExceededException e) {
if (dynamicConfigurationManager.getConfiguration().getInboundMessageByteLimitConfiguration().enforceInboundLimit()) {
throw e;
}
}
try {
boolean isSyncMessage = source.isPresent() && source.get().getAccount().isIdentifiedBy(destinationUuid);