joseflauzino commented on a change in pull request #5649:
URL: https://github.com/apache/cloudstack/pull/5649#discussion_r741889484



##########
File path: 
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java
##########
@@ -325,14 +326,20 @@ public void sentSuccessfully(final QuotaAccountDao 
quotaAccountDao) {
         }
     };
 
-    protected void sendQuotaAlert(List<String> emails, String subject, String 
body) {
+    protected void sendQuotaAlert(String accountUuid, List<String> emails, 
String subject, String body) {
         SMTPMailProperties mailProperties = new SMTPMailProperties();
 
         mailProperties.setSender(new MailAddress(senderAddress));
         mailProperties.setSubject(subject);
         mailProperties.setContent(body);
         mailProperties.setContentType("text/html; charset=utf-8");
 
+        if (CollectionUtils.isEmpty(emails)) {
+            s_logger.warn(String.format("Unable to send quota alert email with 
subject [%s] and content [%s]. "

Review comment:
       Thanks for the review @ravening
   I changed the message to make it more evident that quota alert emails are 
not being sent just because the email list is empty. But I found it important 
to keep the "subject" and "content" information, because it makes it easier to 
decide if it's something crucial to deal with or not.

##########
File path: 
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java
##########
@@ -325,14 +326,20 @@ public void sentSuccessfully(final QuotaAccountDao 
quotaAccountDao) {
         }
     };
 
-    protected void sendQuotaAlert(List<String> emails, String subject, String 
body) {
+    protected void sendQuotaAlert(String accountUuid, List<String> emails, 
String subject, String body) {
         SMTPMailProperties mailProperties = new SMTPMailProperties();
 
         mailProperties.setSender(new MailAddress(senderAddress));
         mailProperties.setSubject(subject);
         mailProperties.setContent(body);
         mailProperties.setContentType("text/html; charset=utf-8");
 
+        if (CollectionUtils.isEmpty(emails)) {
+            s_logger.warn(String.format("Unable to send quota alert email with 
subject [%s] and content [%s]. "

Review comment:
       Thanks for the review @ravening
   I changed the message to make it more evident that quota alert emails are 
not being sent just because the email list is empty. But I found it important 
to keep the "account", "subject", and "content" information, because it makes 
it easier to decide if it's something crucial to deal with or not.

##########
File path: server/src/main/java/com/cloud/alert/AlertManagerImpl.java
##########
@@ -706,14 +707,13 @@ public void sendAlert(AlertType alertType, long 
dataCenterId, Long podId, Long c
             newAlert.setName(alertType.getName());
             _alertDao.persist(newAlert);
         } else {
-            if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Have already sent: " + 
alert.getSentCount() + " emails for alert type '" + alertType + "' -- skipping 
send email");
-                }
+            logger.debug("Have already sent: " + alert.getSentCount() + " 
emails for alert type '" + alertType + "' -- skipping send email");

Review comment:
       @DaanHoogland My intention is to reduce cyclomatic complexity, as this 
check is only executed because we did not update to Log4J yet. Also, for this 
situation, the computing costs is irrelevant.




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


Reply via email to