public SingletonManager(IDistributedLockManager lockManager, IOptions <SingletonOptions> options, IWebJobsExceptionHandler exceptionHandler, ILoggerFactory loggerFactory, IHostIdProvider hostIdProvider, INameResolver nameResolver = null) { _lockManager = lockManager; _nameResolver = nameResolver; _options = options.Value; _loggerFactory = loggerFactory; _exceptionHandler = exceptionHandler; _logger = _loggerFactory?.CreateLogger(LogCategories.Singleton); _hostIdProvider = hostIdProvider; }
internal static TimeSpan GetLockAcquisitionTimeout(SingletonAttribute attribute, SingletonOptions config) { TimeSpan acquisitionTimeout = attribute.LockAcquisitionTimeout != -1 ? TimeSpan.FromSeconds(attribute.LockAcquisitionTimeout) : config.LockAcquisitionTimeout; return(acquisitionTimeout); }
internal static TimeSpan GetLockPeriod(SingletonAttribute attribute, SingletonOptions config) { return(attribute.Mode == SingletonMode.Listener ? config.ListenerLockPeriod : config.LockPeriod); }