fail method

  1. @override
Future<void> fail(
  1. Job job
)
override

Permanently removes a failed job and stores it in the dead letter queue.

Implementation

@override
Future<void> fail(Job job) async {
  await _db.query('''
    UPDATE $_table
    SET status = 'failed',
        finished_at = NOW(),
        last_error = @lastError,
        attempts = @attempts,
        reserved_by = NULL
    WHERE id = @id
  ''', {
    'id': job.id,
    'lastError': job.lastError?.toString(),
    'attempts': job.attempts,
  });
}