Beispiel #1
0
 public JobQueue(ConnectionMultiplexer connection)
 {
     _id               = Guid.NewGuid();
     _connection       = connection;
     _subscriber       = connection.GetSubscriber();
     _executor         = new PollingExecutor(_options.PollRate);
     _listeners        = new ConcurrentDictionary <string, Func <object, Task> >();
     _listenersNoArgs  = new ConcurrentDictionary <string, Func <Task> >();
     _semaphore        = new SemaphoreSlim(_options.MaxConcurrentJobs);
     _pollingSemaphore = new SemaphoreSlim(1, 1);
     _lockFactory      = RedLockFactory.Create(new List <RedLockMultiplexer>
     {
         _connection
     });
 }
Beispiel #2
0
 public JobQueue(ConnectionMultiplexer connection, JobQueueOptions options) : this(connection)
 {
     _options   = options;
     _executor  = new PollingExecutor(_options.PollRate);
     _semaphore = new SemaphoreSlim(_options.MaxConcurrentJobs);
 }