diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index a2d76ac3..49da8532 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -1949,8 +1949,14 @@ class _MessageBubble extends StatelessWidget { ? const EdgeInsets.symmetric(horizontal: 8) : EdgeInsets.zero, child: Text( + // `retryCount` is a zero-based attempt index + // and `maxMessageRetries` is a count, so + // printing them together showed the fifth and + // final attempt of five as "4/5", which reads + // as a sixth attempt still to come. The flood + // fallback had already fired by then. (#1223) context.l10n.chat_retryCount( - message.retryCount, + message.retryCount + 1, context .read() .settings diff --git a/lib/services/message_retry_service.dart b/lib/services/message_retry_service.dart index d061409f..e91fe901 100644 --- a/lib/services/message_retry_service.dart +++ b/lib/services/message_retry_service.dart @@ -678,12 +678,19 @@ class MessageRetryService extends ChangeNotifier { final shortText = message.text.length > 20 ? '${message.text.substring(0, 20)}...' : message.text; + // Attempts are numbered from 1 in anything a human reads. `retryCount` is a + // zero-based index, and printing it raw made the last attempt of five read + // as "attempt 4", which reads as a sixth attempt that never came. It also + // said "retrying" on the final timeout, when the message is being failed. + final bool willRetry = message.retryCount < maxRetries - 1; config?.debugLogService?.warn( - 'Timeout: No ACK received for "$shortText" to ${contact.name} (attempt ${message.retryCount}) → retrying', + 'Timeout: No ACK received for "$shortText" to ${contact.name} ' + '(attempt ${message.retryCount + 1} of $maxRetries)' + '${willRetry ? ' → retrying' : ' → giving up, marking failed'}', tag: 'AckHash', ); - if (message.retryCount < maxRetries - 1) { + if (willRetry) { final backoffMs = 1000 * (1 << message.retryCount); if (selection != null) {