chibenwa commented on code in PR #1673:
URL: https://github.com/apache/james-project/pull/1673#discussion_r1300993938


##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraQuotaCurrentValueDao.java:
##########
@@ -125,15 +129,27 @@ public Mono<Void> increase(QuotaKey quotaKey, long 
amount) {
             .setString(QUOTA_COMPONENT, 
quotaKey.getQuotaComponent().getValue())
             .setString(IDENTIFIER, quotaKey.getIdentifier().asString())
             .setString(QUOTA_TYPE, quotaKey.getQuotaType().getValue())
-            .setLong(CURRENT_VALUE, amount));
+            .setLong(CURRENT_VALUE, amount))
+            .onErrorResume(ex -> {
+                LOGGER.error("Failure when increasing {} {} quota for {}. 
Quota current value is thus not updated and needs recomputation",
+                    quotaKey.getQuotaComponent().getValue(), 
quotaKey.getQuotaType().getValue(), quotaKey.getIdentifier().asString());
+                LOGGER.error(ex.getMessage());
+                return Mono.empty();

Review Comment:
   ```suggestion
                   LOGGER.warn("Failure when increasing {} {} quota for {}. 
Quota current value is thus not updated and needs recomputation",
                       quotaKey.getQuotaComponent().getValue(), 
quotaKey.getQuotaType().getValue(), quotaKey.getIdentifier().asString(), ex);
                   return Mono.empty();
   ```
   
    -> WARN: this won't prevent the system from working, no need to be so 
worrysome.
    -> Only one line logs or correlating both logs will be impossible
    -> Do not loose stack traces



##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraQuotaCurrentValueDao.java:
##########
@@ -125,15 +129,27 @@ public Mono<Void> increase(QuotaKey quotaKey, long 
amount) {
             .setString(QUOTA_COMPONENT, 
quotaKey.getQuotaComponent().getValue())
             .setString(IDENTIFIER, quotaKey.getIdentifier().asString())
             .setString(QUOTA_TYPE, quotaKey.getQuotaType().getValue())
-            .setLong(CURRENT_VALUE, amount));
+            .setLong(CURRENT_VALUE, amount))
+            .onErrorResume(ex -> {
+                LOGGER.error("Failure when increasing {} {} quota for {}. 
Quota current value is thus not updated and needs recomputation",
+                    quotaKey.getQuotaComponent().getValue(), 
quotaKey.getQuotaType().getValue(), quotaKey.getIdentifier().asString());
+                LOGGER.error(ex.getMessage());
+                return Mono.empty();
+            });
     }
 
     public Mono<Void> decrease(QuotaKey quotaKey, long amount) {
         return queryExecutor.executeVoid(decreaseStatement.bind()
             .setString(QUOTA_COMPONENT, 
quotaKey.getQuotaComponent().getValue())
             .setString(IDENTIFIER, quotaKey.getIdentifier().asString())
             .setString(QUOTA_TYPE, quotaKey.getQuotaType().getValue())
-            .setLong(CURRENT_VALUE, amount));
+            .setLong(CURRENT_VALUE, amount))
+            .onErrorResume(ex -> {
+                LOGGER.error("Failure when decreasing {} {} quota for {}. 
Quota current value is thus not updated and needs recomputation",
+                    quotaKey.getQuotaComponent().getValue(), 
quotaKey.getQuotaType().getValue(), quotaKey.getIdentifier().asString());
+                LOGGER.error(ex.getMessage());

Review Comment:
   IDEM



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

Reply via email to