Skip to content

Commit

Permalink
chore: performance
Browse files Browse the repository at this point in the history
  • Loading branch information
ychung-mot committed Jun 4, 2024
1 parent dfb54d7 commit 9b5c900
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/StrDss.Hangfire/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
app.UseHangfireDashboard();

// make sure this is after app.UseHangfireDashboard()
RecurringJob.AddOrUpdate<HangfireJobs>("Process Rental Listing Report", job => job.ProcessRentalListingReports(), "0 0/3 * * *");
RecurringJob.AddOrUpdate<HangfireJobs>("Process Rental Listing Report", job => job.ProcessRentalListingReports(), "*/5 * * * *");
RecurringJob.AddOrUpdate<HangfireJobs>("Process Takedown Request Batch Emails", job => job.ProcessTakedownRequestBatchEmails(), "50 6 * * *");

app.Run();
6 changes: 6 additions & 0 deletions server/StrDss.Service/RentalListingReportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
}

Expand Down

0 comments on commit 9b5c900

Please sign in to comment.