Module: Sidekiq::Group
- Defined in:
- lib/sidekiq/group.rb,
lib/sidekiq/group/worker.rb,
lib/sidekiq/group/version.rb,
lib/sidekiq/group/collection.rb,
lib/sidekiq/group/middleware.rb
Defined Under Namespace
Modules: Middleware
Classes: Collection, NoBlockGivenError, Worker
Constant Summary
collapse
- VERSION =
'0.3.0'.freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.debug ⇒ Object
Returns the value of attribute debug.
10
11
12
|
# File 'lib/sidekiq/group.rb', line 10
def debug
@debug
end
|
Class Method Details
.progress(group_id) ⇒ Object
12
13
14
15
16
|
# File 'lib/sidekiq/group.rb', line 12
def progress(group_id)
group = Sidekiq::Group::Collection.new(group_id)
{ total: group.total, processed: group.processed }
end
|
Instance Method Details
#on_complete(_options = {}) ⇒ Object
36
37
38
|
# File 'lib/sidekiq/group.rb', line 36
def on_complete(_options = {})
sidekiq_logger.warn 'on_complete function is not defined'
end
|
#sidekiq_group(options = {}) {|group| ... } ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/sidekiq/group.rb', line 19
def sidekiq_group(options = {})
raise NoBlockGivenError unless block_given?
group = Sidekiq::Group::Collection.new
group.callback_class = self.class.name
group.callback_options = options
group.initialize_total_value
Thread.current[:group_collection] = group
yield(group)
group.spawned_jobs!
Thread.current[:group_collection] = nil
end
|
#sidekiq_logger ⇒ Object
40
41
42
|
# File 'lib/sidekiq/group.rb', line 40
def sidekiq_logger
Sidekiq.logger
end
|