|
|
@@ -70,7 +70,7 @@ namespace qdr.fnd.core.pqueue.Process
|
|
|
OnValidate();
|
|
|
}
|
|
|
/// <inheritdoc />
|
|
|
- public async void Start()
|
|
|
+ public void Start()
|
|
|
{
|
|
|
if (IsRunning)
|
|
|
throw new PsProcessProviderException(PsProcessProviderException.ErrorCodes.ProcessProviderIsRunning, GetType().Name, ItemId);
|
|
|
@@ -81,24 +81,29 @@ namespace qdr.fnd.core.pqueue.Process
|
|
|
StartedTimestamp = DateTime.Now;
|
|
|
var timeout = GetArgumentValue<TimeSpan>(CS_ARG_PROCESS_TIMEOUT);
|
|
|
|
|
|
- try
|
|
|
+
|
|
|
+ Task.Run(async () =>
|
|
|
{
|
|
|
- await TimeoutUtils.ExecuteWithTimeoutAsync(async () =>
|
|
|
+
|
|
|
+ try
|
|
|
{
|
|
|
+ await TimeoutUtils.ExecuteWithTimeoutAsync(async () =>
|
|
|
+ {
|
|
|
|
|
|
- await OnProcess().ContinueWith(task =>
|
|
|
+ await OnProcess().ContinueWith(task =>
|
|
|
+ {
|
|
|
+ ProcessDoneOk("Succesfuly done.");
|
|
|
+ });
|
|
|
+ }, timeout);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ await OnProcessError(e).ContinueWith(task =>
|
|
|
{
|
|
|
- ProcessDoneOk("Succesfuly done.");
|
|
|
+ ProcessDoneFailed(e.Message, e);
|
|
|
});
|
|
|
- }, timeout);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- await OnProcessError(e).ContinueWith(task =>
|
|
|
- {
|
|
|
- ProcessDoneFailed(e.Message, e);
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
@@ -107,7 +112,7 @@ namespace qdr.fnd.core.pqueue.Process
|
|
|
if (!IsRunning)
|
|
|
throw new PsProcessProviderException(PsProcessProviderException.ErrorCodes.ProcessProviderNotRunning, GetType().Name, ItemId);
|
|
|
|
|
|
- _cancelationToken?.Cancel();
|
|
|
+ _cancelationToken?.Cancel();
|
|
|
ProcessDoneFailed("Process was forced stopped.");
|
|
|
Log.Log(LogSeverityEnum.Info, $"Provider for ItemId='{ItemId}' was forced stopped.");
|
|
|
}
|