JeetKunDoug commented on code in PR #192:
URL: https://github.com/apache/cassandra-sidecar/pull/192#discussion_r1956605477
##########
server/src/main/java/org/apache/cassandra/sidecar/tasks/PeriodicTaskExecutor.java:
##########
@@ -130,22 +147,33 @@ private void schedule(PeriodicTaskKey key, long
priorExecDurationMillis, long de
*/
private void executeAndScheduleNext(PeriodicTaskKey key, long execCount)
{
+ Promise<Void> runPromise = Promise.promise();
+ if (activeRuns.computeIfAbsent(key, k -> runPromise.future()) !=
runPromise)
Review Comment:
But why do you need the `runPromise`? It's _never_ used for anything except
to call `runPromise.complete()` on line 160 below - the future isn't ever
actually used as far as I can tell. It _used_ to be used in `unschedule but now
it's just ignored anyway - if you turn `activeRuns` into a `ConcurrentHashSet`
and run all the tests, it just works (although that may be more of an
indication that there are code paths that are uncovered in the current tests?)
--
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]