this what method get features return and next time it will be 200
Hello. I created FeatureDefinitionProvider in the domain layer. Is it ok? because I need to take some data from the database. Is it possible to do like this? And then I use the feature checker as You provide in the documentation. Can the name of the feature be with white space?
I am asking because when I created these features and load to prod, they were working correctly. But after several deploys, they fell. The method where I use the feature checker works every second time. I mean one time it returns a response next time it returns 500 HTTP error. And say that can't found feature the first in the list.
My using of feature checker :
public async Task<List<AssessmentTypeDto?>> GetMovementsTestFeatures() { var mvmTypes = await _asmTypeRepository.GetAssessmentTypes(AssessmentTypeNames.Movement); return await GetListAssessmentTypesWithCheckedFeatures(mvmTypes); }
private async Task<List<AssessmentTypeDto>> GetListAssessmentTypesWithCheckedFeatures(List<AssessmentType> asmtypes)
{
var results = _objectMapper.Map<List<AssessmentType>, List<AssessmentTypeDto>>(asmtypes);
var updatedResults = new List<AssessmentTypeDto>();
foreach (var m in results)
{
var isEnableType = await _featureChecker.IsEnabledAsync(m.Code);
if (isEnableType)
{
var movements = new List<AssessmentMovementDto>();
foreach (var x in m.Movements)
{
var isEnabled = await _featureChecker.IsEnabledAsync(x.Code);
if (isEnabled)
{
movements.Add(x);
}
}
m.Movements = movements.OrderBy(x => x.DisplayOrder).ToList();
}
else
{
m.Movements = new List<AssessmentMovementDto>();
}
if (isEnableType)
{
updatedResults.Add(m);
}
}
return updatedResults;
}