Module: Litejob::ClassMethods
- Defined in:
- lib/litestack/litejob.rb
Instance Method Summary collapse
- #delete(id) ⇒ Object
- #get_jobqueue ⇒ Object
- #options ⇒ Object
- #perform_after(delay, *params) ⇒ Object
- #perform_async(*params) ⇒ Object
- #perform_at(time, *params) ⇒ Object
- #perform_in(delay, *params) ⇒ Object
- #process_jobs ⇒ Object
- #queue ⇒ Object
- #queue=(queue_name) ⇒ Object
Instance Method Details
#delete(id) ⇒ Object
69 70 71 |
# File 'lib/litestack/litejob.rb', line 69 def delete(id) get_jobqueue.delete(id) end |
#get_jobqueue ⇒ Object
89 90 91 |
# File 'lib/litestack/litejob.rb', line 89 def get_jobqueue Litejobqueue.jobqueue() end |
#options ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/litestack/litejob.rb', line 81 def @options ||= begin self::DEFAULT_OPTIONS rescue {} end end |
#perform_after(delay, *params) ⇒ Object
61 62 63 |
# File 'lib/litestack/litejob.rb', line 61 def perform_after(delay, *params) perform_in(delay, *params) end |
#perform_async(*params) ⇒ Object
48 49 50 |
# File 'lib/litestack/litejob.rb', line 48 def perform_async(*params) get_jobqueue.push(name, params, 0, queue) end |
#perform_at(time, *params) ⇒ Object
52 53 54 55 |
# File 'lib/litestack/litejob.rb', line 52 def perform_at(time, *params) delay = time.to_i - Time.now.to_i get_jobqueue.push(name, params, delay, queue) end |
#perform_in(delay, *params) ⇒ Object
57 58 59 |
# File 'lib/litestack/litejob.rb', line 57 def perform_in(delay, *params) get_jobqueue.push(name, params, delay, queue) end |
#process_jobs ⇒ Object
65 66 67 |
# File 'lib/litestack/litejob.rb', line 65 def process_jobs get_jobqueue end |
#queue ⇒ Object
73 74 75 |
# File 'lib/litestack/litejob.rb', line 73 def queue @queue_name ||= "default" end |
#queue=(queue_name) ⇒ Object
77 78 79 |
# File 'lib/litestack/litejob.rb', line 77 def queue=(queue_name) @queue_name = queue_name.to_s end |