Hide + archive stale listings (old jobs, expired shifts)
- 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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user