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

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