From a436d9c0700554b36e773286b37a39ef118fddf6 Mon Sep 17 00:00:00 2001 From: Dekel Asaf Date: Fri, 22 Sep 2017 20:54:47 +0300 Subject: [PATCH] fixed #529 --- mRemoteV1/App/Runtime.cs | 2 +- .../Multiuser/SqlConnectionsUpdateChecker.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs index 317c34249..a7b7a0aa5 100644 --- a/mRemoteV1/App/Runtime.cs +++ b/mRemoteV1/App/Runtime.cs @@ -42,7 +42,7 @@ namespace mRemoteNG.App public static NotificationAreaIcon NotificationAreaIcon { get; set; } public static RemoteConnectionsSyncronizer RemoteConnectionsSyncronizer { get; set; } // ReSharper disable once UnusedAutoPropertyAccessor.Local - private static DateTime LastSqlUpdate { get; set; } + public static DateTime LastSqlUpdate { get; set; } public static ExternalToolsService ExternalToolsService { get; } = new ExternalToolsService(); public static SecureString EncryptionKey { get; set; } = new RootNodeInfo(RootNodeType.Connection).PasswordString.ConvertToSecureString(); public static ICredentialRepositoryList CredentialProviderCatalog { get; } = new CredentialRepositoryList(); diff --git a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs index d88b88987..8cc7daf4b 100644 --- a/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs +++ b/mRemoteV1/Config/Connections/Multiuser/SqlConnectionsUpdateChecker.cs @@ -57,7 +57,15 @@ namespace mRemoteNG.Config.Connections private bool DatabaseIsMoreUpToDateThanUs() { - return GetLastUpdateTimeFromDbResponse() > _lastUpdateTime; + var lastUpdateInDb = GetLastUpdateTimeFromDbResponse(); + var IAmTheLastoneUpdated = CheckIfIAmTheLastOneUpdated(lastUpdateInDb); + return (lastUpdateInDb > _lastUpdateTime && !IAmTheLastoneUpdated); + } + + private bool CheckIfIAmTheLastOneUpdated(DateTime lastUpdateInDb) + { + DateTime LastSqlUpdateWithoutMilliseconds = new DateTime(Runtime.LastSqlUpdate.Ticks - (Runtime.LastSqlUpdate.Ticks % TimeSpan.TicksPerSecond), Runtime.LastSqlUpdate.Kind); + return lastUpdateInDb == LastSqlUpdateWithoutMilliseconds; } private DateTime GetLastUpdateTimeFromDbResponse()