forked from ddrilling/AsbCloudServer
BackgroundWorkDto add progress to default state message/
This commit is contained in:
parent
552553bb64
commit
4f45cfc1dd
@ -172,7 +172,7 @@ namespace AsbCloudApp.Data
|
|||||||
if (progress.HasValue)
|
if (progress.HasValue)
|
||||||
CurrentState.Progress = progress.Value;
|
CurrentState.Progress = progress.Value;
|
||||||
|
|
||||||
Trace.TraceInformation($"{WorkNameForTrace} state: {newState}");
|
Trace.TraceInformation($"{WorkNameForTrace} state: {newState} [{100*progress:#}%]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,7 +19,7 @@ public class BackgroundWorker : BackgroundService
|
|||||||
public WorkStore WorkStore { get; } = new WorkStore();
|
public WorkStore WorkStore { get; } = new WorkStore();
|
||||||
public Work? CurrentWork;
|
public Work? CurrentWork;
|
||||||
|
|
||||||
public Exception? MainLoopLastException { get; private set; } = null;
|
public string MainLoopLastException { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public BackgroundWorker(IServiceProvider serviceProvider)
|
public BackgroundWorker(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
@ -54,14 +54,13 @@ public class BackgroundWorker : BackgroundService
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainLoopLastException = ex;
|
MainLoopLastException = $"BackgroundWorker " +
|
||||||
var mainLoopLastException = $"BackgroundWorker " +
|
|
||||||
$"MainLoopLastException: \r\n" +
|
$"MainLoopLastException: \r\n" +
|
||||||
$"date: {DateTime.Now:O}\r\n" +
|
$"date: {DateTime.Now:O}\r\n" +
|
||||||
$"message: {ex.Message}\r\n" +
|
$"message: {ex.Message}\r\n" +
|
||||||
$"inner: {ex.InnerException?.Message}\r\n" +
|
$"inner: {ex.InnerException?.Message}\r\n" +
|
||||||
$"stackTrace: {ex.StackTrace}";
|
$"stackTrace: {ex.StackTrace}";
|
||||||
Trace.TraceError(mainLoopLastException);
|
Trace.TraceError(MainLoopLastException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user