import { Redis , Pipeline } from 'ioredis' ; import { map } from 'lodash' ; import { exec } from '../utils/redis' ; import { Task } from '../domain/tasks/task' ; import { markTaskFailedMulti } from './mark-task-failed' ; ignore export const markTasksFailedMulti = ( { tasksAndErrors , queue , multi , remove , } ) : Task [ ] => { const failedTasks = map ( tasksAndErrors , ( { task , error } ) => markTaskFailedMulti ( { task , queue , multi , error , remove } ) ) ; return failedTasks ; } ; ignore export const markTasksFailed = async ( { tasksAndErrors , queue , client , remove , } ) : Promise < Task [ ] > => { const multi = client . multi ( ) ; const failedTasks = markTasksFailedMulti ( { tasksAndErrors , queue , multi , remove , } ) ; await exec ( multi ) ; return failedTasks ; } ;