Fixes Publishing/Unpublishing variants and it's nuances

This commit is contained in:
Shannon
2018-05-07 23:22:52 +10:00
parent 7a92691bf5
commit 5a991c9424
21 changed files with 281 additions and 128 deletions

View File

@@ -12,14 +12,16 @@ namespace Umbraco.Web.Scheduling
private readonly IRuntimeState _runtime;
private readonly IContentService _contentService;
private readonly ILogger _logger;
private readonly IUserService _userService;
public ScheduledPublishing(IBackgroundTaskRunner<RecurringTaskBase> runner, int delayMilliseconds, int periodMilliseconds,
IRuntimeState runtime, IContentService contentService, ILogger logger)
IRuntimeState runtime, IContentService contentService, ILogger logger, IUserService userService)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_runtime = runtime;
_contentService = contentService;
_logger = logger;
_userService = userService;
}
public override bool PerformRun()
@@ -57,7 +59,7 @@ namespace Umbraco.Web.Scheduling
// fixme context & events during scheduled publishing?
// in v7 we create an UmbracoContext and an HttpContext, and cache instructions
// are batched, and we have to explicitely flush them, how is it going to work here?
var publisher = new ScheduledPublisher(_contentService, _logger);
var publisher = new ScheduledPublisher(_contentService, _logger, _userService);
var count = publisher.CheckPendingAndProcess();
}
catch (Exception e)

View File

@@ -26,6 +26,7 @@ namespace Umbraco.Web.Scheduling
{
private IRuntimeState _runtime;
private IContentService _contentService;
private IUserService _userService;
private IAuditService _auditService;
private ILogger _logger;
private ProfilingLogger _proflog;
@@ -44,12 +45,13 @@ namespace Umbraco.Web.Scheduling
private IBackgroundTask[] _tasks;
public void Initialize(IRuntimeState runtime,
IContentService contentService, IAuditService auditService,
IContentService contentService, IAuditService auditService, IUserService userService,
HealthCheckCollection healthChecks, HealthCheckNotificationMethodCollection notifications,
IScopeProvider scopeProvider, ILogger logger, ProfilingLogger proflog)
{
_runtime = runtime;
_contentService = contentService;
_userService = userService;
_auditService = auditService;
_scopeProvider = scopeProvider;
_logger = logger;
@@ -116,7 +118,7 @@ namespace Umbraco.Web.Scheduling
{
// scheduled publishing/unpublishing
// install on all, will only run on non-slaves servers
var task = new ScheduledPublishing(_publishingRunner, 60000, 60000, _runtime, _contentService, _logger);
var task = new ScheduledPublishing(_publishingRunner, 60000, 60000, _runtime, _contentService, _logger, _userService);
_publishingRunner.TryAdd(task);
return task;
}