Module: Shitekiq
- Defined in:
- lib/shitekiq.rb,
lib/shitekiq/version.rb,
lib/shitekiq/backend/redis.rb
Defined Under Namespace
Modules: Backend, ClassMethods
Classes: Error
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.backend ⇒ Object
17
18
19
|
# File 'lib/shitekiq.rb', line 17
def self.backend
@backend ||= Queue.new
end
|
.backend=(provider) ⇒ Object
21
22
23
|
# File 'lib/shitekiq.rb', line 21
def self.backend=(provider)
@backend = provider
end
|
13
14
15
|
# File 'lib/shitekiq.rb', line 13
def self.configure(&block)
yield self
end
|
.included(base) ⇒ Object
9
10
11
|
# File 'lib/shitekiq.rb', line 9
def self.included(base)
base.extend(ClassMethods)
end
|
.pool_size=(count) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/shitekiq.rb', line 25
def self.pool_size=(count)
count.times do |number|
thread = Thread.new do
loop do
payload = backend.pop
job = payload[:job]
job.new.perform(payload[:args])
end
end
thread.name = "Thread #{number + 1}"
end
end
|
Instance Method Details
48
49
50
|
# File 'lib/shitekiq.rb', line 48
def perform(*args)
raise NotImplementedError
end
|