Skip to content

Commit 981c9a7

Browse files
Load balancing backoffice: Add missing id to distributed jobs when updating (#20642)
* Add ID when updating background job * Reduce default period to 5 seconds * Apply suggestions from code review Co-authored-by: Andy Butland <[email protected]> --------- Co-authored-by: Andy Butland <[email protected]>
1 parent bd6ab83 commit 981c9a7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/Umbraco.Core/Configuration/Models/DistributedJobSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Core.Configuration.Models;
88
[UmbracoOptions(Constants.Configuration.ConfigDistributedJobs)]
99
public class DistributedJobSettings
1010
{
11-
internal const string StaticPeriod = "00:00:10";
11+
internal const string StaticPeriod = "00:00:05";
1212
internal const string StaticDelay = "00:01:00";
1313

1414
/// <summary>

src/Umbraco.Infrastructure/Models/DistributedBackgroundJobModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
/// </summary>
66
public class DistributedBackgroundJobModel
77
{
8+
/// <summary>
9+
/// The id of the job.
10+
/// </summary>
11+
public int Id { get; set; }
12+
813
/// <summary>
914
/// Name of job.
1015
/// </summary>

src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DistributedJobRepository.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public void Delete(DistributedBackgroundJobModel distributedBackgroundJob)
9090
private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) =>
9191
new()
9292
{
93+
Id = model.Id,
9394
Name = model.Name,
9495
Period = model.Period.Ticks,
9596
LastRun = model.LastRun,
@@ -100,6 +101,7 @@ private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) =>
100101
private DistributedBackgroundJobModel MapFromDto(DistributedJobDto jobDto) =>
101102
new()
102103
{
104+
Id = jobDto.Id,
103105
Name = jobDto.Name,
104106
Period = TimeSpan.FromTicks(jobDto.Period),
105107
LastRun = jobDto.LastRun,

0 commit comments

Comments
 (0)