@Override
    public void run() {
        try {
            // get the date before `before` days
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            calendar.add(Calendar.DAY_OF_MONTH, -before);

            Date daysBefore = calendar.getTime();
            List<String> groupIds = groupMapper.selectDeletedGroupIdsWithTimeBefore(daysBefore, batchSize);
            if (CollectionUtils.isEmpty(groupIds)) {
                return;
            }

            log.info("begin to delete data before {}, group ids {}", daysBefore, groupIds);

            // cleanse configuration data
            groupMapper.deleteByInlongGroupIds(groupIds);
            groupExtMapper.deleteByInlongGroupIds(groupIds);
            streamMapper.deleteByInlongGroupIds(groupIds);
            streamExtMapper.deleteByInlongGroupIds(groupIds);
            streamFieldMapper.deleteByInlongGroupIds(groupIds);

            streamSinkMapper.deleteByInlongGroupIds(groupIds);
            streamSinkFieldMapper.deleteByInlongGroupIds(groupIds);
            streamSourceMapper.deleteByInlongGroupIds(groupIds);
            streamSourceFieldMapper.deleteByInlongGroupIds(groupIds);
            streamTransformMapper.deleteByInlongGroupIds(groupIds);
            streamTransformFieldMapper.deleteByInlongGroupIds(groupIds);

            // cleanse workflow data
            List<Integer> processIds = workflowProcessMapper.selectByInlongGroupIds(groupIds);
            workflowProcessMapper.deleteByProcessIds(processIds);
            workflowTaskMapper.deleteByProcessIds(processIds);
            workflowEventLogMapper.deleteByProcessIds(processIds);

            log.info("success to delete data before {}, group ids size: {}", daysBefore, groupIds.size());
        } catch (Exception e) {
            log.error("exception while cleansing data from db: ", e);
        }
    }
The execution starts after this delay in seconds.
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/task/DataCleansingTask.java