From 262469512641b84052da47cf295084ad066bb722 Mon Sep 17 00:00:00 2001 From: mole Date: Fri, 24 Oct 2025 12:57:27 +0200 Subject: [PATCH 1/3] Add ID when updating background job --- .../Models/DistributedBackgroundJobModel.cs | 5 +++++ .../Repositories/Implement/DistributedJobRepository.cs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs b/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs index 2ac0287ba86d..91198d25e9ac 100644 --- a/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs +++ b/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs @@ -5,6 +5,11 @@ /// public class DistributedBackgroundJobModel { + /// + /// The id of the job. + /// + public int? Id { get; set; } + /// /// Name of job. /// diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs index 6436a24d7bfc..81af51ab3690 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs @@ -90,6 +90,7 @@ public void Delete(DistributedBackgroundJobModel distributedBackgroundJob) private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) => new() { + Id = model.Id ?? 0, Name = model.Name, Period = model.Period.Ticks, LastRun = model.LastRun, @@ -100,6 +101,7 @@ private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) => private DistributedBackgroundJobModel MapFromDto(DistributedJobDto jobDto) => new() { + Id = jobDto.Id, Name = jobDto.Name, Period = TimeSpan.FromTicks(jobDto.Period), LastRun = jobDto.LastRun, From 9d3e68e75d4aee2c4cc81880fda9dee7a294e25e Mon Sep 17 00:00:00 2001 From: mole Date: Fri, 24 Oct 2025 12:57:39 +0200 Subject: [PATCH 2/3] Reduce default period to 5 seconds --- src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs b/src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs index 49baff36b496..cafe666b7bb3 100644 --- a/src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Core.Configuration.Models; [UmbracoOptions(Constants.Configuration.ConfigDistributedJobs)] public class DistributedJobSettings { - internal const string StaticPeriod = "00:00:10"; + internal const string StaticPeriod = "00:00:05"; internal const string StaticDelay = "00:01:00"; /// From 1e39525789751f826d2fad0fbc1be3b8baa2e290 Mon Sep 17 00:00:00 2001 From: Mole Date: Sat, 25 Oct 2025 11:04:53 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Andy Butland --- .../Models/DistributedBackgroundJobModel.cs | 2 +- .../Repositories/Implement/DistributedJobRepository.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs b/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs index 91198d25e9ac..899f71e172fb 100644 --- a/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs +++ b/src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs @@ -8,7 +8,7 @@ public class DistributedBackgroundJobModel /// /// The id of the job. /// - public int? Id { get; set; } + public int Id { get; set; } /// /// Name of job. diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs index 81af51ab3690..4e6502dc7d11 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs @@ -90,7 +90,7 @@ public void Delete(DistributedBackgroundJobModel distributedBackgroundJob) private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) => new() { - Id = model.Id ?? 0, + Id = model.Id, Name = model.Name, Period = model.Period.Ticks, LastRun = model.LastRun,