Potential gmail history id fix.

This commit is contained in:
Burak Kaan Köse
2026-04-23 15:00:55 +02:00
parent 6f82cd4f26
commit 8fe40e9fe3
2 changed files with 55 additions and 4 deletions
+12 -2
View File
@@ -1897,9 +1897,19 @@ public class GmailSynchronizer : WinoSynchronizer<IClientServiceRequest, Message
if (historyId == null) return false;
var newHistoryId = historyId.Value;
var currentSynchronizationIdentifier = Account.SynchronizationDeltaIdentifier;
return Account.SynchronizationDeltaIdentifier == null ||
(ulong.TryParse(Account.SynchronizationDeltaIdentifier, out ulong currentIdentifier) && newHistoryId > currentIdentifier);
if (string.IsNullOrWhiteSpace(currentSynchronizationIdentifier))
return true;
if (!ulong.TryParse(currentSynchronizationIdentifier, out ulong currentIdentifier))
{
_logger.Warning("Current Gmail history ID '{HistoryId}' is invalid for {Name}. Replacing it with {NewHistoryId}.",
currentSynchronizationIdentifier, Account.Name, newHistoryId);
return true;
}
return newHistoryId > currentIdentifier;
}
private async Task UpdateAccountSyncIdentifierAsync(ulong? historyId)