5 commented on code in PR #205:
URL: https://github.com/apache/cassandra-sidecar/pull/205#discussion_r1996233232


##########
server/src/main/java/org/apache/cassandra/sidecar/datahub/SchemaReportingTask.java:
##########
@@ -94,17 +97,34 @@ public DurationSpec delay()
     }
 
     @Override
-    public void execute(Promise<Void> promise)
+    public void execute(@NotNull Promise<Void> promise)
+    {
+        execute(promise, 1);
+    }
+
+    protected void execute(@NotNull Promise<Void> promise,
+                           int attempt)
     {
         try
         {
+            LOGGER.info("Schema report has been triggered by the schedule");
             reporter.process(session.get().getCluster());
             promise.complete();
         }
         catch (Throwable throwable)
         {
-            LOGGER.error("Failed to convert and report the current schema", 
throwable);
-            promise.fail(throwable);
+            if (attempt < configuration.retries())
+            {
+                LOGGER.warn("Schema report has failed and will be retried 
soon", throwable);
+                executor.setTimer(configuration.delay().toMillis(),
+                                  identifier -> execute(promise, attempt + 1));
+                // Retry will take care of either completing or failing the 
promise
+            }
+            else
+            {
+                LOGGER.error("Schema report is failing repeatedly and will not 
be retried", throwable);

Review Comment:
   These are great suggestions, fixed.



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