Пример #1
0
 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;
 }
Пример #2
0
        internal static TimeSpan GetLockAcquisitionTimeout(SingletonAttribute attribute, SingletonOptions config)
        {
            TimeSpan acquisitionTimeout = attribute.LockAcquisitionTimeout != -1
                    ? TimeSpan.FromSeconds(attribute.LockAcquisitionTimeout)
                    : config.LockAcquisitionTimeout;

            return(acquisitionTimeout);
        }
Пример #3
0
 internal static TimeSpan GetLockPeriod(SingletonAttribute attribute, SingletonOptions config)
 {
     return(attribute.Mode == SingletonMode.Listener ?
            config.ListenerLockPeriod : config.LockPeriod);
 }