Merge pull request #5109 from sbwalker/dev

clean up scheduled jobs which have been uninstalled
This commit is contained in:
Shaun Walker 2025-02-18 09:12:48 -05:00 committed by GitHub
commit 46bcad1fca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,14 @@ namespace Oqtane.Repository
{
return _cache.GetOrCreate("jobs", entry =>
{
// remove any jobs which have been uninstalled
foreach (var job in _db.Job.ToList())
{
if (Type.GetType(job.JobType) == null)
{
DeleteJob(job.JobId);
}
}
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
return _db.Job.ToList();
});