当hangfire server正在设置定期作业时,出现以下异常:
[DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'lock:recurring-job:AppJobId' resource.]
Hangfire.Pro.Redis.RedisDistributedLock.RetryUntilTrue(Func`1 action, TimeSpan timeout) +442
Hangfire.Pro.Redis.RedisDistributedLock..ctor(Func`1 databaseFactory, ILockExtender lockExtender, String resource, String lockToken, TimeSpan timeout) +165
Hangfire.Pro.Redis.DistributedLockWrapper..ctor(RedisConnection connection, String resource, TimeSpan timeout) +142
Hangfire.Pro.Redis.RedisConnection.AcquireDistributedLock(String resource, TimeSpan timeout) +52
Hangfire.RecurringJobExtensions.AcquireDistributedRecurringJobLock(IStorageConnection connection, String recurringJobId, TimeSpan timeout) +64
Hangfire.RecurringJobManager.AddOrUpdate(String recurringJobId, Job job, String cronExpression, RecurringJobOptions options) +172
Hangfire.RecurringJobManagerExtensions.AddOrUpdate(IRecurringJobManager manager, String recurringJobId, Job job, String cronExpression) +95
App.HangFire.Models.RecuringJobs.SetUpRecurringJobs() +2022
App.HangFire.WebApiApplication.Application_Start() +261
[HttpException (0x80004005): Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'lock:recurring-job:AppJobId' resource.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +517
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369
[HttpException (0x80004005): Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'lock:recurring-job:AppJobId' resource.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714
这导致后台服务加载时间过长,最终导致上述异常;我正在使用hangfire.pro.redis 2.7.1.0
请帮忙!!!
暂无答案!
目前还没有任何答案,快来回答吧!