public async Task <IWorkerInfo> GetWorkerInfo(string activityId) { var loadFactor = await _provider.GetWorkerStatus(activityId); return(new AppServiceWorkerInfo { PartitionKey = AppServiceSettings.WorkerPartitionKey, RowKey = AppServiceSettings.GetWorkerRowKey(AppServiceSettings.CurrentStampName, AppServiceSettings.WorkerName), StampName = AppServiceSettings.CurrentStampName, WorkerName = AppServiceSettings.WorkerName, LoadFactor = loadFactor }); }
public async Task <IWorkerInfo> GetManager() { var table = await GetWorkerCloudTable(); // read manager row var operation = TableOperation.Retrieve <AppServiceWorkerInfo>(AppServiceSettings.ManagerPartitionKey, AppServiceSettings.ManagerRowKey); var result = await table.ExecuteAsync(operation); var manager = result.Result as IWorkerInfo; if (manager != null) { // read from worker table var partitionKey = AppServiceSettings.WorkerPartitionKey; var rowKey = AppServiceSettings.GetWorkerRowKey(manager.StampName, manager.WorkerName); operation = TableOperation.Retrieve <AppServiceWorkerInfo>(partitionKey, rowKey); result = await table.ExecuteAsync(operation); manager = result.Result as IWorkerInfo; } return(manager); }