Files
Umbraco-CMS/src/Umbraco.Infrastructure/Persistence/Repositories/IDistributedJobRepository.cs
Nikolaj Geisle 20de48a496 Load Balancing: Implement distributed background jobs (#20397)
* Start work

* Introduce dto

* Start making repository

* Add migrations

* Implement fetchable first job

* Fix up to also finish tasks

* Refactor jobs to distributed background jobs

* Filter jobs correctly on LastRun

* Hardcode delay

* Add settings to configure delay and period

* Fix formatting

* Add default data

* Add update on startup, which will update periods on startup

* Refactor service to return job directly

* Update src/Umbraco.Infrastructure/Services/Implement/DistributedJobService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/BackgroundJobs/DistributedBackgroundJobHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Umbraco.Infrastructure/BackgroundJobs/DistributedBackgroundJobHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove unused

* Move jobs and make internal

* make OpenIddictCleanupJob.cs public, as it is used elsewhere

* Minor docstring changes

* Update src/Umbraco.Core/Persistence/Constants-Locks.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* ´Throw correct exceptions

* Update xml doc

* Remove business logic from repository

* Remove more business logic from repository into service

* Remove adding jobs from migration

* fix creation

* Rename to ExecuteAsync

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: mole <nikolajlauridsen@protonmail.ch>
2025-10-07 18:49:21 +02:00

37 lines
940 B
C#

using Umbraco.Cms.Infrastructure.Models;
namespace Umbraco.Cms.Infrastructure.Persistence.Repositories;
/// <summary>
/// Defines a repository for managing distributed jobs.
/// </summary>
public interface IDistributedJobRepository
{
/// <summary>
/// Gets a job by name.
/// </summary>
/// <returns></returns>
DistributedBackgroundJobModel? GetByName(string jobName);
/// <summary>
/// Gets all jobs.
/// </summary>
/// <returns></returns>
IEnumerable<DistributedBackgroundJobModel> GetAll();
/// <summary>
/// Updates a job.
/// </summary>
void Update(DistributedBackgroundJobModel distributedBackgroundJob);
/// <summary>
/// Adds a job.
/// </summary>
void Add(DistributedBackgroundJobModel distributedBackgroundJob);
/// <summary>
/// Deletes a job.
/// </summary>
void Delete(DistributedBackgroundJobModel distributedBackgroundJob);
}