@Override
    public <T> boolean schedule(
        TaskInstance<T> taskInstance, Instant executionTime, ScheduleOptions scheduleOptions) {

      boolean successfulSchedule = scheduleIfNotExists(taskInstance, executionTime);
      if (successfulSchedule) {
        return true;
      }

      WhenExists whenExists = scheduleOptions.getWhenExists();
      if (whenExists == WhenExists.DO_NOTHING) {
        // failed to schedule, but user has chosen to ignore
        LOG.debug("Task instance already exists. Keeping existing. task-instance={}", taskInstance);
        return false;

      } else if (whenExists == WhenExists.RESCHEDULE) {
        // successfulSchedule = false, whenExists = RESCHEDULE
        //   i.e. failed to schedule because it already exists -> try reschedule
        var existing = getScheduledExecution(taskInstance);
        if (existing.isEmpty()) {
          // something must have processed it and deleted it
          LOG.warn(
              "Task-instance should already exist, but failed to find it. "
                  + "It must have been processed and deleted. task-instance={}",
              taskInstance);
          return false;
        }

        LOG.debug("Task instance already exists. Rescheduling. task-instance={}", taskInstance);
        return reschedule(taskInstance, executionTime, taskInstance.getData());

      } else {
        throw new IllegalArgumentException("Unknown WhenExists value: " + whenExists);
      }
    }
Will cause getScheduledExecutions(..) to return executions in priority order.
db-scheduler/src/main/java/com/github/kagkarlsson/scheduler/SchedulerClient.java