Refactored all synchronizers to deal with some of the chronic issues.

This commit is contained in:
Burak Kaan Köse
2026-02-06 01:18:12 +01:00
parent d1425ca9ca
commit 071f1c9786
43 changed files with 2785 additions and 582 deletions
@@ -4,5 +4,6 @@ public enum SynchronizationCompletedState
{
Success, // All succeeded.
Canceled, // Canceled by user or HTTP call.
Failed // Exception.
Failed, // Exception.
PartiallyCompleted // Some folders succeeded, some failed.
}
@@ -0,0 +1,47 @@
namespace Wino.Core.Domain.Enums;
/// <summary>
/// Categorizes synchronization errors by their root cause for targeted handling.
/// </summary>
public enum SynchronizerErrorCategory
{
/// <summary>
/// Network-related issues: connection timeouts, DNS failures, socket errors.
/// </summary>
Network,
/// <summary>
/// Authentication failures: invalid credentials, expired tokens, revoked access.
/// </summary>
Authentication,
/// <summary>
/// Rate limiting: too many requests (HTTP 429), quota exceeded.
/// </summary>
RateLimit,
/// <summary>
/// Resource not found: folder or message deleted externally (HTTP 404).
/// </summary>
ResourceNotFound,
/// <summary>
/// Server errors: internal server errors (HTTP 5xx), service unavailable.
/// </summary>
ServerError,
/// <summary>
/// Protocol errors: IMAP/SMTP command failures, malformed responses.
/// </summary>
ProtocolError,
/// <summary>
/// Validation errors: invalid data, constraint violations.
/// </summary>
Validation,
/// <summary>
/// Unknown or unclassified error.
/// </summary>
Unknown
}
@@ -0,0 +1,31 @@
namespace Wino.Core.Domain.Enums;
/// <summary>
/// Classifies the severity of synchronization errors to determine retry behavior.
/// </summary>
public enum SynchronizerErrorSeverity
{
/// <summary>
/// Transient error that should be retried with exponential backoff.
/// Examples: network timeout, temporary server unavailability, rate limiting.
/// </summary>
Transient,
/// <summary>
/// Error that can be recovered from by skipping the affected item/folder and continuing sync.
/// Examples: folder deleted externally, message not found, permission denied on single item.
/// </summary>
Recoverable,
/// <summary>
/// Fatal error that requires stopping synchronization and user intervention.
/// Examples: account disabled, server permanently unavailable, critical configuration error.
/// </summary>
Fatal,
/// <summary>
/// Authentication error that requires the user to re-authenticate.
/// Examples: token expired, password changed, OAuth refresh failed.
/// </summary>
AuthRequired
}