Skip to content

Commit 64ae3d4

Browse files
committed
Added ability to update the taskworker
1 parent 7b8d9de commit 64ae3d4

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

dotNet/CoreHelpers.TaskLogging.Abstractions/ITaskLoggerFactory.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ public interface ITaskLoggerFactory
6262
/// <param name="taskId"></param>
6363
/// <param name="taskStatus"></param>
6464
/// <returns></returns>
65-
Task UpdateTaskStatus(string taskId, TaskStatus taskStatus);
65+
Task UpdateTaskStatus(string taskId, TaskStatus taskStatus);
66+
67+
/// <summary>
68+
/// Allows to update the worker of a task, especially useful for task reassignment
69+
/// </summary>
70+
/// <param name="taskId"></param>
71+
/// <param name="taskWorker"></param>
72+
/// <returns></returns>
73+
Task UpdateTaskWorker(string taskId, string taskWorker);
6674
}
6775
}
6876

dotNet/CoreHelpers.TaskLogging/AzureStorageTableTaskLoggerFactory.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,23 @@ public async Task UpdateTaskStatus(string taskKey, TaskStatus taskStatus)
9999
}
100100
}
101101

102+
public async Task UpdateTaskWorker(string taskId, string taskWorker)
103+
{
104+
// build the task entity
105+
var taskEntity = new AzureTableTaskEntity()
106+
{
107+
PartitionKey = taskId,
108+
RowKey = taskId,
109+
TaskWorker = taskWorker
110+
};
111+
112+
// get the table name
113+
var tableName = GetTaskTable();
114+
115+
// update the entity
116+
await UpdateEntityInTable<AzureTableTaskEntity>(tableName, taskEntity);
117+
}
118+
102119
public ITaskLogger CreateTaskLogger(string taskKey)
103120
{
104121
return new AzureStorageTableTaskLogger(taskKey, _cacheLimit, _cacheTimespan, this);

0 commit comments

Comments
 (0)