void (@Nullable ChangedFilesPushingStatistics statistics) { boolean hadTasks = false; while (true) { ProgressManager.checkCanceled(); // give a chance to suspend indexing Runnable task = myTasks.poll(); if (task == null) { break; } try { task.run(); hadTasks = true; } catch (ProcessCanceledException e) { if (statistics != null) { statistics.finished(true); ChangedFilesPushedDiagnostic.INSTANCE.addEvent(myProject, statistics); } queueTasks(Collections.singletonList(task), "Rerun pushing tasks after process cancelled"); // reschedule dumb mode and ensure the canceled task is enqueued again throw e; } } if (hadTasks) { scheduleDumbModeReindexingIfNeeded(); } if (statistics != null) { statistics.finished(false); ChangedFilesPushedDiagnostic.INSTANCE.addEvent(myProject, statistics); } }