private async Task <RoutineRecord> TryLoadRoutineRecordAsync(CancellationToken ct) { if (_routineRecord == null) { var serviceId = await GetServiceIdAsync(ct); var routineDescriptor = await GetRoutineDescriptorAsync(ct); try { _routineRecord = await _routinesTable.TryRetrieveAsync <RoutineRecord>( serviceId.ServiceName, routineDescriptor.RoutineId, RoutineRecordPropertiesToRequest, ct); } catch (TableDoesNotExistException) { } if (_routineRecord != null) { routineDescriptor.ETag = _routineRecord.ETag; } } return(_routineRecord); }
public async Task <ActiveRoutineInfo> PollRoutineResultAsync( ActiveRoutineInfo info, CancellationToken ct) { RoutineRecord routineRecord; try { routineRecord = await _routinesTable.TryRetrieveAsync <RoutineRecord>( _serviceId.ServiceName, info.RoutineId, RoutineRecordPropertiesForPolling, ct); } catch (TableDoesNotExistException) { routineRecord = null; } if (routineRecord != null) { TaskResult routineResult = null; if (routineRecord.Status == (int)RoutineStatus.Complete && !string.IsNullOrEmpty(routineRecord.Result)) { routineResult = _serializer.Deserialize <TaskResult>(routineRecord.Result); } info = new ActiveRoutineInfo { ETag = routineRecord.ETag, RoutineId = info.RoutineId, Result = routineResult }; } return(info); }