How to detected the need for reinitalize? #1310
ricardoamm
started this conversation in
General
Replies: 1 comment
-
Hey @ricardoamm There is no easy path to get this information, as there is no "out of the box" method available. This first code is to be executed on the client side. // Get Server scope info
var sScopeInfo = await agent.RemoteOrchestrator.GetScopeInfoAsync();
// Get the last timestamp when clenaup has been made on the server side
var serverLastCleanupTimestamp = sScopeInfo.LastCleanupTimestamp;
// Get Client scope info client
var sScopeInfoClient = await agent.LocalOrchestrator.GetScopeInfoClientAsync();
// Get the last time we made a sync to the server, using the server timestamp value
var clientLastSyncTimestamp = sScopeInfoClient.LastServerSyncTimestamp;
var isOutDated = false;
if (clientLastSyncTimestamp.HasValue && serverLastCleanupTimestamp.HasValue)
isOutDated = clientLastSyncTimestamp < serverLastCleanupTimestamp;
if (isOutDated)
{
....
} If you want the same information from the server side, and you know the client id you are targetting: var remoteOrchestrator = new RemoteOrchestrator(serverProvider, options);
// Get Server scope info and the last timestamp when clenaup has been made on the server side
var sScopeInfo = await remoteOrchestrator.GetScopeInfoAsync();
var serverLastCleanupTimestamp = sScopeInfo.LastCleanupTimestamp;
// Get Client scope info client identified by the client id, and its last timestamp sync.
var sScopeInfoClient = await remoteOrchestrator.GetScopeInfoClientAsync(clientId);
var clientLastSyncTimestamp = sScopeInfoClient.LastServerSyncTimestamp;
var isOutDated = false;
if (clientLastSyncTimestamp.HasValue && serverLastCleanupTimestamp.HasValue)
isOutDated = clientLastSyncTimestamp < serverLastCleanupTimestamp;
if (isOutDated)
{
....
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have several clients, and sometimes it is needed to reinitialize , but they don't know that. I want to detect the need for reinitialization and force the reinitialization when the application is closed in a separate thread, because it is a time-consuming process.
Beta Was this translation helpful? Give feedback.
All reactions