mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-176] Additional logging for task execution
This commit is contained in:
parent
87a3a67b12
commit
41c547bf16
@ -71,6 +71,11 @@ namespace Acacia.Utils
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class TaskExecutor
|
||||
@ -136,8 +141,13 @@ namespace Acacia.Utils
|
||||
|
||||
public static void Task(AcaciaTask task, bool synchronous = false)
|
||||
{
|
||||
Logger.Instance.Debug(typeof(Tasks), "TASK added: {0}", task);
|
||||
if (synchronous)
|
||||
{
|
||||
Logger.Instance.Debug(typeof(Tasks), "TASK exec synchronous 1: {0}", task);
|
||||
task.Execute();
|
||||
Logger.Instance.Debug(typeof(Tasks), "TASK exec synchronous 2: {0}", task);
|
||||
}
|
||||
else
|
||||
Executor.AddTask(task);
|
||||
}
|
||||
|
@ -38,16 +38,29 @@ namespace Acacia.Utils
|
||||
|
||||
private void Worker()
|
||||
{
|
||||
while (!_tasks.IsCompleted)
|
||||
try
|
||||
{
|
||||
AcaciaTask task = _tasks.Take();
|
||||
PerformTask(task);
|
||||
while (!_tasks.IsCompleted)
|
||||
{
|
||||
Logger.Instance.Debug(this, "Take task 1");
|
||||
AcaciaTask task = _tasks.Take();
|
||||
Logger.Instance.Debug(this, "Take task 2: {0}", task);
|
||||
PerformTask(task);
|
||||
Logger.Instance.Debug(this, "Take task 3: {0}", task);
|
||||
}
|
||||
Logger.Instance.Debug(this, "Worker completed");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Instance.Debug(this, "Worker failure: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void EnqueueTask(AcaciaTask task)
|
||||
{
|
||||
Logger.Instance.Debug(this, "EnqueueTask 1: {0}", task);
|
||||
_tasks.Add(task);
|
||||
Logger.Instance.Debug(this, "EnqueueTask 2: {0}", task);
|
||||
}
|
||||
|
||||
override public string Name { get { return "Background"; } }
|
||||
|
Loading…
Reference in New Issue
Block a user