JeetKunDoug commented on code in PR #192:
URL: https://github.com/apache/cassandra-sidecar/pull/192#discussion_r1956284331


##########
server/src/main/java/org/apache/cassandra/sidecar/tasks/PeriodicTaskExecutor.java:
##########
@@ -329,15 +343,18 @@ public String toString()
         }
     }
 
-    @VisibleForTesting
-    Map<PeriodicTaskKey, Long> timerIds()
+    enum Result
     {
-        return timerIds;
+        /**
+         * Tells the run completion handler whether task is rescheduled.
+         * If it is rescheduled, the delay is adjusted to the initial delay of 
the task
+         */
+        RESCHEDULED

Review Comment:
   Yeah - the biggest thing to me was that this enum is used as the type of an 
AsyncResult<T> and we set the result to `RESCHEDULED` or nothing at all, which 
was just jarring when I was looking at the code.
   
   What do you think of actually using the `ScheduleDecision` enum here, and 
just getting rid of the `Result` all together? Then each branch of the 
`executeInternal` method would actually be able to indicate which decision was 
made - we end up only _using_ `RESCHEDULE` right now but at least there isn't 
an odd mix of `promise.tryComplete()` and 
`promise.tryComplete(Result.RESCHEDULE)` which didn't make a lot of sense to me 
- if the promise is a `Promise<Result>` it should really be completed with 
_something_ other than null... using `Promise<ScheduleDecision>` makes more 
sense.



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