module Elastics::LiveReindex::Redis
private module
Constants
- KEYS
Public Instance Methods
init()
click to toggle source
# File lib/elastics/admin_live_reindex.rb, line 34 def init raise MissingRedisError, 'The live-reindex feature rely on redis. Please, install redis and the "redis" gem.' \ unless Conf.redis.class.to_s == 'Redis' raise MissingAppIdError, 'You must set the Elastics::Configuration.app_id, and be sure you deploy it before live-reindexing.' \ if Conf.app_id.nil? || Conf.app_id.empty? if get(:pid) && (pid = get(:pid).to_i) message = begin Process.kill(0, pid) %(The live-reindex of "#{Conf.app_id}" is in progress (PID #{pid}).) rescue Errno::ESRCH # no process running (will reset_keys and continue) rescue Exception %(It looks like the live-reindex of "#{Conf.app_id}" is in progress (PID #{pid}). If you are sure that there is no live-reindex in progress, please run the "elastics:admin:reset_redis_keys APP_ID=#{Conf.app_id}" rake task and retry.) end raise LiveReindexInProgressError, message if message end reset_keys set(:pid, $$) end
method_missing(command, key, *args)
click to toggle source
# File lib/elastics/admin_live_reindex.rb, line 25 def method_missing(command, key, *args) return unless Conf.redis Conf.redis.send(command, "#{KEYS[key]}-#{Conf.app_id}", *args) end
reset_keys()
click to toggle source
# File lib/elastics/admin_live_reindex.rb, line 30 def reset_keys KEYS.keys.each { |k| del k } end