Class: Resque::Plugins::Stages::Cleaner

Inherits:
Object
  • Object
show all
Includes:
RedisAccess
Defined in:
lib/resque/plugins/stages/cleaner.rb

Overview

A class for cleaning up stranded objects for the Stages plugin

Constant Summary

Constants included from RedisAccess

RedisAccess::NAME_SPACE

Class Method Summary collapse

Methods included from RedisAccess

#redis

Class Method Details

.cleanup_jobsObject



23
24
25
26
27
28
29
30
31
# File 'lib/resque/plugins/stages/cleaner.rb', line 23

def cleanup_jobs
  jobs = redis.keys("StagedJob::*")

  jobs.each do |job_key|
    job = Resque::Plugins::Stages::StagedJob.new(job_key[11..])

    job.verify
  end
end

.purge_allObject



15
16
17
18
19
20
21
# File 'lib/resque/plugins/stages/cleaner.rb', line 15

def purge_all
  keys = redis.keys("*")

  return if keys.blank?

  redis.del(*keys)
end

.redisObject



11
12
13
# File 'lib/resque/plugins/stages/cleaner.rb', line 11

def redis
  @redis ||= Resque::Plugins::Stages::Cleaner.new.redis
end