@@ -315,7 +315,11 @@ public <V> void cancel(HugeTask<V> task) {
315315
316316 // Task not running locally, update status to CANCELLING
317317 // for cronSchedule() or other nodes to handle
318- this .updateStatus (task .id (), null , TaskStatus .CANCELLING );
318+ TaskStatus currentStatus = task .status ();
319+ if (!this .updateStatus (task .id (), currentStatus , TaskStatus .CANCELLING )) {
320+ LOG .info ("Failed to cancel task '{}', status may have changed from {}" ,
321+ task .id (), currentStatus );
322+ }
319323 }
320324
321325 @ Override
@@ -340,9 +344,6 @@ protected <V> HugeTask<V> deleteFromDB(Id id) {
340344 @ Override
341345 public <V > HugeTask <V > delete (Id id , boolean force ) {
342346 HugeTask <?> task = this .taskWithoutResult (id );
343- if (task == null ) {
344- return null ;
345- }
346347
347348 if (!force ) {
348349 // Check task status: can't delete running tasks without force
@@ -515,11 +516,6 @@ private <V> V call(Callable<V> callable, ExecutorService executor) {
515516 protected boolean updateStatus (Id id , TaskStatus prestatus ,
516517 TaskStatus status ) {
517518 HugeTask <Object > task = this .taskWithoutResult (id );
518- if (task == null ) {
519- // Task was already deleted by cronSchedule or another thread
520- LOG .info ("Task '{}' not found, may have been deleted" , id );
521- return false ;
522- }
523519 initTaskParams (task );
524520 if (prestatus == null || task .status () == prestatus ) {
525521 task .overwriteStatus (status );
0 commit comments