module Antelopes::Master

ServerEngine master. Its job is to create a connection pool towards Redis and share it with the loopers. This class should not be used directly by Antelopes users.

@since 0.0.1 @private

Attributes

redis[R]

@!attribute [r] redis

@return [ConnectionPool] the a redis connection pool

Public Instance Methods

after_run() click to toggle source

Method called by ServerEngine before shutting down

@since 0.0.1

# File lib/antelopes/master.rb, line 28
def after_run
  logger.info 'Master shutting down'
  @redis.shutdown(&:quit)
end
before_run() click to toggle source

Method called by ServerEngine before starting the workers. It initialize the redis connection pool used by the Loopers.

@since 0.0.1

# File lib/antelopes/master.rb, line 20
def before_run
  logger.info 'Master starting'
  @redis = ConnectionPool.new(size: 5, timeout: 3) { Antelopes::Redis.new.connection }
end