recordSyncFailure method
Records a failed push attempt for queueEntryId.
0.2.0 semantics:
- Stores
errorinlast_error. - If
incrementRetryCount(defaulttrue), incrementsretry_count. - Writes
nextRetryAtto the entry'snext_retry_atcolumn. Passnullto clear (rare; engine always passes a value when called for a real failure).
Pass incrementRetryCount: false and omit nextRetryAt to retain
0.1.0 "just record the error" behaviour. Atomic with transaction.
Implementation
@override
Future<void> recordSyncFailure(
String queueEntryId,
String error, {
DateTime? nextRetryAt,
bool incrementRetryCount = true,
}) async {
final i = _queue.indexWhere((e) => e.id == queueEntryId);
if (i < 0) throw StateError('Queue entry $queueEntryId not found');
final cur = _queue[i];
_queue[i] = cur.copyWith(
lastError: error,
retryCount: incrementRetryCount ? cur.retryCount + 1 : cur.retryCount,
nextRetryAt: nextRetryAt,
);
}