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 <abutland73@gmail.com> --------- Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
@@ -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";
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
/// </summary>
|
||||
public class DistributedBackgroundJobModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The id of the job.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of job.
|
||||
/// </summary>
|
||||
|
||||
@@ -90,6 +90,7 @@ internal class DistributedJobRepository(IScopeAccessor scopeAccessor) : IDistrib
|
||||
private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) =>
|
||||
new()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Period = model.Period.Ticks,
|
||||
LastRun = model.LastRun,
|
||||
@@ -100,6 +101,7 @@ internal class DistributedJobRepository(IScopeAccessor scopeAccessor) : IDistrib
|
||||
private DistributedBackgroundJobModel MapFromDto(DistributedJobDto jobDto) =>
|
||||
new()
|
||||
{
|
||||
Id = jobDto.Id,
|
||||
Name = jobDto.Name,
|
||||
Period = TimeSpan.FromTicks(jobDto.Period),
|
||||
LastRun = jobDto.LastRun,
|
||||
|
||||
Reference in New Issue
Block a user