Class: Resque::Pertry::Purger

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/pertry/purger.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.failed_jobs_limitObject



19
20
21
# File 'lib/resque/pertry/purger.rb', line 19

def failed_jobs_limit
  @failed_jobs_limit ||= 100
end

.sleep_timeObject



15
16
17
# File 'lib/resque/pertry/purger.rb', line 15

def sleep_time
  @sleep_time ||= 5.minutes
end

.verboseObject

Returns the value of attribute verbose.



7
8
9
# File 'lib/resque/pertry/purger.rb', line 7

def verbose
  @verbose
end

Class Method Details

.after_database_purge(&block) ⇒ Object

allows an app to set a hook to deal with the failed persistence table job



58
59
60
# File 'lib/resque/pertry/purger.rb', line 58

def after_database_purge(&block)
  @after_database_purge = block
end

.after_redis_purge(&block) ⇒ Object

allows an app to set a hook to deal with the failed redis job



53
54
55
# File 'lib/resque/pertry/purger.rb', line 53

def after_redis_purge(&block)
  @after_redis_purge = block
end

.purgeObject

run a purge cycle



38
39
40
41
42
43
44
# File 'lib/resque/pertry/purger.rb', line 38

def purge
  procline("working")
  add_stat(:loops, 1)

  purge_resque
  purge_database
end

.runObject

main loop



28
29
30
31
32
33
34
35
# File 'lib/resque/pertry/purger.rb', line 28

def run
  setup

  loop do
    purge
    wait
  end
end

.statsObject



23
24
25
# File 'lib/resque/pertry/purger.rb', line 23

def stats
  @stats ||= {}
end

.statusObject

display status of failed queues and persistence table



47
48
49
50
# File 'lib/resque/pertry/purger.rb', line 47

def status
  show_config
  show_info
end