fail method
Implementation
@override
Future<void> fail(String id, String error, StackTrace stackTrace) async {
await initialize();
final rows = await database.query(
'SELECT attempts, max_attempts FROM $tableName WHERE id = ?',
<Object?>[id],
);
if (rows.isEmpty) return;
final attempts = (rows.first['attempts'] as int) + 1;
final maxAttempts = rows.first['max_attempts'] as int;
final state =
attempts >= maxAttempts ? DVJobState.deadLettered : DVJobState.queued;
await database.execute(
'UPDATE $tableName SET attempts = ?, state = ?, last_error = ? '
'WHERE id = ?',
<Object?>[attempts, state.name, error, id],
);
}