Hide + archive stale listings (old jobs, expired shifts)
CI/CD / CI · dotnet build (push) Successful in 37s
CI/CD / Deploy · hamkadr (push) Successful in 48s

- ListingPolicy.JobFreshnessDays=30: public /Jobs and home hide jobs older than the cutoff (shifts already require Date>=today)
- ListingArchiver flips stale Open→Expired: shifts past their date, jobs older than the cutoff. Runs at startup and on every IngestionWorker cycle (independent of ingestion being enabled)
- Verified: backdated job dropped off /Jobs (6→5) and was archived to Expired on the sweep

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-04 09:57:06 +03:30
parent 178e44c4da
commit 6d2ad6f87e
5 changed files with 62 additions and 2 deletions
+5
View File
@@ -44,6 +44,7 @@ builder.Services.AddSingleton<JobsMedical.Web.Services.Scraping.IListingSource,
JobsMedical.Web.Services.Scraping.DivarListingSource>();
builder.Services.AddSingleton<JobsMedical.Web.Services.Scraping.IListingSource,
JobsMedical.Web.Services.Scraping.MedjobsListingSource>();
builder.Services.AddScoped<JobsMedical.Web.Services.Scraping.ListingArchiver>();
builder.Services.AddScoped<JobsMedical.Web.Services.Scraping.IngestionService>();
builder.Services.AddHostedService<JobsMedical.Web.Services.Scraping.IngestionWorker>();
@@ -74,6 +75,10 @@ using (var scope = app.Services.CreateScope())
db.Database.Migrate();
// Production seeds reference data only (no demo facilities/shifts); dev seeds the full board.
await SeedData.EnsureSeededAsync(db, app.Environment.IsDevelopment());
// Archive any listings that went stale while the app was down.
await scope.ServiceProvider
.GetRequiredService<JobsMedical.Web.Services.Scraping.ListingArchiver>()
.ArchiveStaleAsync();
}
// Configure the HTTP request pipeline.