private void traverseMemoryTasksToStore() {
        taskMap.values().forEach((task) -> {
            TaskProfile profileFromStore = taskStore.getTask(task.getTaskId());
            if (profileFromStore == null) {
                deleteFromMemory(task.getTaskId());
                return;
            }
            TaskStateEnum stateFromStore = profileFromStore.getState();
            if (stateFromStore != TaskStateEnum.RUNNING) {
                deleteFromMemory(task.getTaskId());
            }
        });
    }
task in taskMap but not in task store then delete
task in taskMap but task state from task store is FROZEN then delete
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/task/TaskManager.java