public String updateWorkflow(WorkflowModel workflowModel) {
        workflowModel.setUpdatedTime(System.currentTimeMillis());
        if (workflowModel.getStatus().isTerminal()) {
            workflowModel.setEndTime(System.currentTimeMillis());
        }
        externalizeWorkflowData(workflowModel);
        executionDAO.updateWorkflow(workflowModel);
        if (properties.isAsyncIndexingEnabled()) {
            if (workflowModel.getStatus().isTerminal()
                    && workflowModel.getEndTime() - workflowModel.getCreateTime()
                            < properties.getAsyncUpdateShortRunningWorkflowDuration().toMillis()) {
                final String workflowId = workflowModel.getWorkflowId();
                DelayWorkflowUpdate delayWorkflowUpdate = new DelayWorkflowUpdate(workflowId);
                LOGGER.debug(
                        "Delayed updating workflow: {} in the index by {} seconds",
                        workflowId,
                        properties.getAsyncUpdateDelay());
                scheduledThreadPoolExecutor.schedule(
                        delayWorkflowUpdate,
                        properties.getAsyncUpdateDelay().getSeconds(),
                        TimeUnit.SECONDS);
                Monitors.recordWorkerQueueSize(
                        "delayQueue", scheduledThreadPoolExecutor.getQueue().size());
            } else {
                indexDAO.asyncIndexWorkflow(new WorkflowSummary(workflowModel.toWorkflow()));
            }
            if (workflowModel.getStatus().isTerminal()) {
                workflowModel
                        .getTasks()
                        .forEach(
                                taskModel ->
                                        indexDAO.asyncIndexTask(
                                                new TaskSummary(taskModel.toTask())));
            }
        } else {
            indexDAO.indexWorkflow(new WorkflowSummary(workflowModel.toWorkflow()));
        }
        return workflowModel.getWorkflowId();
    }
Updates the given workflow in the data store

@param workflowModel the workflow tp be updated
@return the id of the updated workflow
core/src/main/java/com/netflix/conductor/core/dal/ExecutionDAOFacade.java