code: void tick(long index, long timestamp) {
      // Only create an iterator if there are actually tasks scheduled.
      if (!scheduledTasks.isEmpty()) {
  
        // Iterate through scheduled tasks until we reach a task that has not met its scheduled time.
        // The tasks list is sorted by time on insertion.
        Iterator<ServerScheduledTask> iterator = scheduledTasks.iterator();
        while (iterator.hasNext()) {
          ServerScheduledTask task = iterator.next();
          if (task.complete(timestamp)) {
            context.update(index, Instant.ofEpochMilli(task.time), ServerStateMachineContext.Type.COMMAND);
            task.execute();
            complete.add(task);
            iterator.remove();
          } else {
            break;
          }
        }
  
        // Iterate through tasks that were completed and reschedule them.
        for (ServerScheduledTask task : complete) {
          task.reschedule();
        }
        complete.clear();
      }
    }
docs: Executes scheduled callbacks based on the provided time.