- ABP Framework version: v5.1.2
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
I am attempting to build out some basic reporting features. I created a new end-point.
My application end-point code is as follows
public virtual async Task<PagedResultDto<ReportingContractor>> GetAvailableContractors(Guid? MSA = null, int? trade = null, int? status = null, Guid? vps = null) { List<ContractorDto> _rpt = new List<ContractorDto>();
IQueryable<Trade> queryableTrade = await _trade.GetQueryableAsync();
List<Trade> queryTrade = (from _t in queryableTrade
orderby _t.Id
select _t).ToList();
IQueryable<Status> queryableStatus = await _status.GetQueryableAsync();
List<Status> queryStatus = (from _s in queryableStatus
orderby _s.Id
select _s).ToList();
//Get all the contractors
IQueryable<Contractor> queryablecnt = await _contractor.GetQueryableAsync();
var querycnt = (from cnt in queryablecnt
orderby cnt.Id
select cnt).ToList();
var _cntrList = querycnt.WhereIf(MSA.HasValue, e => e.msaid.Contains(MSA.ToString()))
.WhereIf(trade.HasValue, e => e.tradeid == trade)
.WhereIf(status.HasValue, e => e.status == status)
.WhereIf(vps.HasValue, e => e.procurementSpecialist == vps.ToString());
////Duplicate Contractors for each of the MSA they belong to.
List<Contractor> _cntrItems = new List<Contractor>();
foreach (var _itemCtr in _cntrList.ToList())
{
Contractor _cnItem = new Contractor();
if (_itemCtr.msaid != null)
{
var tags = _itemCtr.msaid.ToString();
string[] _tags = tags.Split(',');
_tags = _tags.Where(x => !string.IsNullOrEmpty(x)).ToArray();
List<string> msaNames = new List<string>();
foreach (string _tag in _tags)
{
if (_tag.ToString() != null)
{
_itemCtr.msaid = _tag.ToString();
_cntrItems.Add(_itemCtr);
}
}
}
}
List<ReportingContractor> _rptItems = new List<ReportingContractor>();
foreach (var _itemCtr in _cntrItems.ToList())
{
ReportingContractor _cnItem = new ReportingContractor();
var rpt = ObjectMapper.Map<Contractor, ReportingContractor>(_itemCtr);
if (rpt.status != 0 || rpt.status != null)
{
foreach (var stat in queryStatus)
{
if (_cnItem.status == stat.Id)
{
rpt.statusName = stat.Name;
break;
}
}
}
if (rpt.tradeid != 0)
{
foreach (var _trade in queryTrade)
{
if (_trade.Id == rpt.tradeid)
{
rpt.tradeName = _trade.Name;
break;
}
}
}
_rptItems.Add(rpt);
}
var _return = new PagedResultDto<ReportingContractor>
{
TotalCount = _rptItems.Count,
Items = _rptItems
};
return _return;
}
The code itself runs at a decent speed given the number of records (close to 900). What I noticed is the code will return values in debug but it takes 3-4x as long for the values to show up in Swagger. I can't seem to figure out what would be causing the issue.
Here is the other areas of code: IContractorAppService
Task<PagedResultDto<ReportingContractor>> GetAvailableContractors(Guid? MSA = null, int? trade = null, int? status = null, Guid? vps = null);
HttpApi ContractorController
[HttpGet] [Route("gcavail")] public virtual Task<PagedResultDto<ReportingContractor>> GetAvailableContractors(Guid? MSA = null, int? trade = null, int? status = null, Guid? vps = null) { return _contractorsAppService.GetAvailableContractors(MSA, trade, status, vps); }
5 Answer(s)
-
0
HI
I don't see obvious problems in the code you shared. You can try to use related tools for profiling,
https://www.jetbrains.com/help/profiler/Introduction.html
-
0
So I downloaded and ran the profiling, but honestly did not see any issues (of course I am not sure what exactly I am looking at). This is very odd issue that I have not run into with other APIs I have added. It takes a good 4 mins or so for the data to return about to the HttpApi project. Not sure what would be between the Application and the HttpApi, but the application project returns the data in less than a min but it takes over 4 mins for it to show up in Swagger. Very weird issue. Could it have anything to do with redis?
-
0
Could it have anything to do with redis?
Yes, 127.0.0.1 is used as the Redis server. If you didn't run the server on 127.0.0.1 there is will be a problem.
-
0
I have redis running on 12.0.0.1 and I got the error with the server running. It almost seems like it can not handle large datasets. So my question, is there a way to turn redis off for specific queries? I would like to keep redis running but having issues like this keeps it from running properly.
-
0
So my question, is there a way to turn redis off for specific queries
We need the Redis.
https://github.com/abpframework/abp/issues/5023#issuecomment-687854205