From 9b5c900c4eb150da5d0119ce53989b56ddd7abb3 Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Tue, 4 Jun 2024 11:29:58 -0700 Subject: [PATCH] chore: performance --- server/StrDss.Hangfire/Program.cs | 2 +- server/StrDss.Service/RentalListingReportService.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/StrDss.Hangfire/Program.cs b/server/StrDss.Hangfire/Program.cs index dc5e9a75..83846d95 100644 --- a/server/StrDss.Hangfire/Program.cs +++ b/server/StrDss.Hangfire/Program.cs @@ -161,7 +161,7 @@ app.UseHangfireDashboard(); // make sure this is after app.UseHangfireDashboard() -RecurringJob.AddOrUpdate("Process Rental Listing Report", job => job.ProcessRentalListingReports(), "0 0/3 * * *"); +RecurringJob.AddOrUpdate("Process Rental Listing Report", job => job.ProcessRentalListingReports(), "*/5 * * * *"); RecurringJob.AddOrUpdate("Process Takedown Request Batch Emails", job => job.ProcessTakedownRequestBatchEmails(), "50 6 * * *"); app.Run(); diff --git a/server/StrDss.Service/RentalListingReportService.cs b/server/StrDss.Service/RentalListingReportService.cs index 17d36616..c139b6f9 100644 --- a/server/StrDss.Service/RentalListingReportService.cs +++ b/server/StrDss.Service/RentalListingReportService.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using NetTopologySuite.Geometries; +using NetTopologySuite.Index.Quadtree; using StrDss.Common; using StrDss.Data; using StrDss.Data.Entities; @@ -336,9 +337,12 @@ private async Task ProcessRentalReportUploadAsync(DssUploadDelivery upload) var headerExists = csv.ReadHeader(); var hasError = false; var isLastLine = false; + var processedCount = 0; while (csv.Read()) { + if (processedCount > 100) break; //To process 100 lines per job + count++; isLastLine = count == lineCount; @@ -366,6 +370,8 @@ private async Task ProcessRentalReportUploadAsync(DssUploadDelivery upload) hasError = !await ProcessUploadLine(report, upload, uploadLine, row, isLastLine); stopwatch.Stop(); + processedCount++; + _logger.LogInformation($"Finishing listing ({row.OrgCd} - {row.ListingId}): {stopwatch.Elapsed.TotalMilliseconds} milliseconds"); }