Sha256: 769ca7f51f41669d32a3355875a9c82b871b1beb3bc576407b6383ccde46add2

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

require 'eventmachine'
# the redis/synchrony gems need to be required in this particular order, see
# the redis-rb README for details
require 'hiredis'
require 'em-synchrony'
require 'redis/connection/synchrony'
require 'redis'

require 'em-synchrony/connection_pool'

require 'flapjack/data/migration'

module Flapjack
  class RedisPool < EventMachine::Synchrony::ConnectionPool

    def initialize(opts = {})
      config = opts.delete(:config)
      @size  = opts[:size] || 5
      logger = opts[:logger]
      super(:size => @size) {
        redis = ::Redis.new(config)
        Flapjack::Data::Migration.correct_notification_rule_contact_linkages(:redis => redis,
          :logger => logger)
        Flapjack::Data::Migration.migrate_entity_check_data_if_required(:redis => redis,
          :logger => logger)
        Flapjack::Data::Migration.create_entity_ids_if_required(:redis => redis,
          :logger => logger)
        Flapjack::Data::Migration.refresh_archive_index(:redis => redis)
        Flapjack::Data::Migration.validate_scheduled_maintenance_periods(:redis => redis,
          :logger => logger)
        redis
      }
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flapjack-1.2.1 lib/flapjack/redis_pool.rb
flapjack-1.2.1rc3 lib/flapjack/redis_pool.rb
flapjack-1.2.1rc2 lib/flapjack/redis_pool.rb