Skip to content

Commit 0b6e400

Browse files
authored
Merge pull request #580 from bcgov/yj
chore: aggr listings logging
2 parents bdc3e7a + 1118d7b commit 0b6e400

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

server/StrDss.Data/Repositories/RentalListingRepository.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
104104

105105
_logger.LogInformation($"Get Grouped Listings (group) - Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
106106

107-
stopwatch.Restart();
108-
109107
foreach (var group in groupedListings.SourceList)
110108
{
111109
group.Listings
@@ -114,10 +112,6 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
114112
hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, group);
115113
}
116114

117-
_logger.LogInformation($"Get Grouped Listings (listings) - Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
118-
119-
stopwatch.Stop();
120-
121115
return groupedListings;
122116
}
123117

@@ -217,19 +211,31 @@ private async Task<List<RentalListingViewDto>> GetRentalListings(string? effecti
217211
string? all, string? address, string? url, string? listingId, string? hostName, string? businessLicence, bool? prRequirement, bool? blRequirement,
218212
long? lgId, string[] statusArray, bool? reassigned, bool? takedownComplete, RentalListingGroupDto group)
219213
{
214+
var stopwatch = Stopwatch.StartNew();
215+
220216
var query = _dbSet.AsNoTracking()
221217
.Where(x => x.MatchAddressTxt == effectiveAddress && x.EffectiveHostNm == effectiveHostName && x.EffectiveBusinessLicenceNo == effectiveBusinessLicenceNo);
222218

223219
ApplyFilters(all, address, url, listingId, hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, ref query);
224220

225221
var filteredIds = await query.Select(x => x.RentalListingId).ToListAsync();
226222

223+
stopwatch.Stop();
224+
225+
_logger.LogInformation($"Get Grouped Listings (filtered listing IDs) - Count: {filteredIds.Count}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
226+
227+
stopwatch.Restart();
228+
227229
var listings = _mapper.Map<List<RentalListingViewDto>>(
228230
await _dbSet.AsNoTracking()
229231
.Where(x => x.MatchAddressTxt == effectiveAddress && x.EffectiveHostNm == effectiveHostName && x.EffectiveBusinessLicenceNo == effectiveBusinessLicenceNo)
230232
.ToListAsync()
231233
);
232234

235+
_logger.LogInformation($"Get Grouped Listings (all listings) - Count: {listings.Count}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
236+
237+
stopwatch.Restart();
238+
233239
group.NightsBookedYtdQty = 0;
234240

235241
foreach (var listing in listings)
@@ -253,6 +259,10 @@ await _dbSet.AsNoTracking()
253259
group.LastActionDtm = listingWithLatestAction.LastActionDtm;
254260
}
255261

262+
stopwatch.Stop();
263+
264+
_logger.LogInformation($"Get Grouped Listings (extra properties) - Count: {listings.Count}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
265+
256266
return listings;
257267
}
258268

0 commit comments

Comments
 (0)