void setCallbackAfter(TaskModel task) {
        String duration =
                Optional.ofNullable(task.getInputData().get(DURATION_INPUT)).orElse("").toString();
        String until =
                Optional.ofNullable(task.getInputData().get(UNTIL_INPUT)).orElse("").toString();

        if (StringUtils.isNotBlank(duration) && StringUtils.isNotBlank(until)) {
            task.setReasonForIncompletion(
                    "Both 'duration' and 'until' specified. Please provide only one input");
            task.setStatus(FAILED_WITH_TERMINAL_ERROR);
            return;
        }

        if (StringUtils.isNotBlank(duration)) {

            Duration timeDuration = parseDuration(duration);
            long waitTimeout = System.currentTimeMillis() + (timeDuration.getSeconds() * 1000);
            task.setWaitTimeout(waitTimeout);
            long seconds = timeDuration.getSeconds();
            task.setCallbackAfterSeconds(seconds);

        } else if (StringUtils.isNotBlank(until)) {
            try {

                Date expiryDate = parseDate(until);
                long timeInMS = expiryDate.getTime();
                long now = System.currentTimeMillis();
                long seconds = ((timeInMS - now) / 1000);
                if (seconds < 0) {
                    seconds = 0;
                }
                task.setCallbackAfterSeconds(seconds);
                task.setWaitTimeout(timeInMS);

            } catch (ParseException parseException) {
                task.setReasonForIncompletion(
                        "Invalid/Unsupported Wait Until format.  Provided: " + until);
                task.setStatus(FAILED_WITH_TERMINAL_ERROR);
            }
        } else {
            // If there is no time duration specified then the WAIT task should wait forever
            task.setCallbackAfterSeconds(Integer.MAX_VALUE);
        }
    }
An implementation of {@link TaskMapper} to map a {@link WorkflowTask} of type {@link
TaskType#WAIT} to a {@link TaskModel} of type {@link Wait} with {@link
TaskModel.Status#IN_PROGRESS}
core/src/main/java/com/netflix/conductor/core/execution/mapper/WaitTaskMapper.java