Fix background work counters

This commit is contained in:
ngfrolov 2023-11-23 14:57:04 +05:00
parent afccdafebc
commit 2b8077a723
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -180,12 +180,12 @@ namespace AsbCloudApp.Data
/// </summary>
protected void SetStatusComplete()
{
CountComplete++;
if (CurrentState is null)
return;
LastComplete = new(CurrentState);
CurrentState = null;
CountComplete++;
Trace.TraceInformation($"{WorkNameForTrace} state: completed");
}
@ -194,12 +194,12 @@ namespace AsbCloudApp.Data
/// </summary>
protected void SetLastError(string errorMessage)
{
CountErrors++;
if (CurrentState is null)
return;
LastError = new LastErrorInfo(CurrentState, errorMessage);
CurrentState = null;
CountErrors++;
Trace.TraceError($"{WorkNameForTrace} throw exception[{CountErrors}]: {errorMessage}");
}
}