fix(#1223): number DM attempts from 1, and stop claiming a retry that is not coming

Ben read "Retry 4/5" on a failed DM and concluded the fifth attempt never
ran. The log from OB-3UJZR proves it did: at 17:38:38 the client sent
CMD_RESET_PATH and then attempt 4, so the flood fallback fired exactly as
ruled. The label was wrong, not the loop.

`retryCount` is a zero-based attempt index and `maxMessageRetries` is a
count of attempts, so the chat label printed one against the other. The
fifth and final attempt of five read as "4/5", which reads as a sixth
attempt still to come.

The AckHash log line had the same fault twice over: it printed the raw
index, and it said "retrying" on the final timeout, when the message is
in fact being marked failed. Both now read from 1 and say which it is.

No l10n change: `chat_retryCount` keeps its "Retry {current}/{max}" form
in all 18 locales and only the number passed in changes.
fix/1238-gitattributes-eol
diffwireauto 2 days ago committed by Strycher
parent 0c0119ed2a
commit ed358cd9d9

@ -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<AppSettingsService>()
.settings

@ -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) {

Loading…
Cancel
Save

Powered by TurnKey Linux.