retryTask method
Future<void>
retryTask(
- dynamic key
)
Implementation
Future<void> retryTask(dynamic key) async {
if (_running.containsKey(key)) {
throw StateError('Cancel the running action before retrying');
}
final task = Map<String, dynamic>.from(_queueBox.get(key) as Map);
if (task['scope'] != currentSession().key) {
throw StateError('Session owner unavailable');
}
task['attempts'] = 0;
task['status'] = 'pending';
task['nextAttemptAt'] = DateTime.now().toIso8601String();
task['lastFailure'] = null;
await _queueBox.put(key, task);
_publish();
_scheduleNext();
}