mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Update JobsQueueProcessor.cs
This commit is contained in:
@@ -12,12 +12,12 @@ namespace Orchard.JobsQueue.Services {
|
|||||||
public class JobsQueueProcessor : IJobsQueueProcessor {
|
public class JobsQueueProcessor : IJobsQueueProcessor {
|
||||||
private readonly Work<IJobsQueueManager> _jobsQueueManager;
|
private readonly Work<IJobsQueueManager> _jobsQueueManager;
|
||||||
private readonly Work<IEventBus> _eventBus;
|
private readonly Work<IEventBus> _eventBus;
|
||||||
private readonly IDistributedLockService _distributedLockService;
|
private readonly Work<IDistributedLockService> _distributedLockService;
|
||||||
|
|
||||||
public JobsQueueProcessor(
|
public JobsQueueProcessor(
|
||||||
Work<IJobsQueueManager> jobsQueueManager,
|
Work<IJobsQueueManager> jobsQueueManager,
|
||||||
Work<IEventBus> eventBus,
|
Work<IEventBus> eventBus,
|
||||||
IDistributedLockService distributedLockService) {
|
Work<IDistributedLockService> distributedLockService) {
|
||||||
|
|
||||||
_jobsQueueManager = jobsQueueManager;
|
_jobsQueueManager = jobsQueueManager;
|
||||||
_eventBus = eventBus;
|
_eventBus = eventBus;
|
||||||
@@ -29,7 +29,7 @@ namespace Orchard.JobsQueue.Services {
|
|||||||
|
|
||||||
public void ProcessQueue() {
|
public void ProcessQueue() {
|
||||||
IDistributedLock @lock;
|
IDistributedLock @lock;
|
||||||
if (_distributedLockService.TryAcquireLock(GetType().FullName, TimeSpan.FromMinutes(5), out @lock)) {
|
if (_distributedLockService.Value.TryAcquireLock(GetType().FullName, TimeSpan.FromMinutes(5), out @lock)) {
|
||||||
using (@lock) {
|
using (@lock) {
|
||||||
IEnumerable<QueuedJobRecord> messages;
|
IEnumerable<QueuedJobRecord> messages;
|
||||||
|
|
||||||
@@ -88,4 +88,4 @@ namespace Orchard.JobsQueue.Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user