1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-115] Added lastsynctime to automatic resync check.

This commit is contained in:
Patrick Simpson 2017-06-14 16:08:11 +02:00
parent 1efaa3e711
commit 30f460184f

View File

@ -99,6 +99,7 @@ namespace Acacia.Features.SyncState
/// </summary>
private DateTime? _syncStallStarted;
private bool _syncStallAsked;
private DateTime? _syncStallLastSyncTime;
#endregion
@ -308,6 +309,11 @@ namespace Acacia.Features.SyncState
{
get { return _data.data.contentdata; }
}
public DateTime LastSyncTime
{
get { return _data.data.lastsynctime; }
}
}
private class GetDeviceDetailsRequest : SoapRequest<DeviceDetails>
@ -322,6 +328,7 @@ namespace Acacia.Features.SyncState
public long Total { get; private set; }
public long Done { get; private set; }
public bool IsSyncing { get; private set; }
public DateTime? LastSyncTime { get; private set; }
private readonly FeatureSyncState _feature;
private readonly ZPushAccount _account;
@ -340,6 +347,8 @@ namespace Acacia.Features.SyncState
{
StringBuilder debug = new StringBuilder();
LastSyncTime = details.LastSyncTime;
// If a folder is no longer reported as it's already synced, we don't necessarily get the
// last step where (done == total). This causes some folders to keep lingering. To clean these
// up, keep a list of folders syncing in this iteration.
@ -495,16 +504,24 @@ namespace Acacia.Features.SyncState
string syncId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
// If it's syncing, it's not stalled
if (syncId != null && syncId != "0")
return;
//if (syncId != null && syncId != "0")
// return;
// Check if the folder has synced. In that case, it's not stalled.
SyncSession sync = account.GetFeatureData<SyncSession>(this, null);
// If the last sync time hasn't changed, it hasn't actually synced yet
if (sync.LastSyncTime != null && _syncStallLastSyncTime == sync.LastSyncTime)
return;
_syncStallLastSyncTime = sync.LastSyncTime;
// Get the sync state
string folderId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
if (folderId != null)
{
SyncSession sync = account.GetFeatureData<SyncSession>(this, null);
// Check if the folder has synced. In that case, it's not stalled.
if (sync.HasFolderSynced(folderId))
return;
return;
}
}