Class: Chewy::Strategy::ResqueAtomic

Inherits:
ResqueBase
  • Object
show all
Defined in:
lib/chewy/strategy/resque_atomic.rb

Instance Method Summary collapse

Methods inherited from ResqueBase

#enqueue

Constructor Details

#initializeResqueAtomic

Returns a new instance of ResqueAtomic.



4
5
6
# File 'lib/chewy/strategy/resque_atomic.rb', line 4

def initialize
  @stash = {}
end

Instance Method Details

#leaveObject



13
14
15
16
17
# File 'lib/chewy/strategy/resque_atomic.rb', line 13

def leave
  @stash.all? do |type, ids|
    enqueue(type, ids)
  end
end

#update(type, objects, options = {}) ⇒ Object



8
9
10
11
# File 'lib/chewy/strategy/resque_atomic.rb', line 8

def update(type, objects, options = {})
  @stash[type] ||= []
  @stash[type] |= type.adapter.identify(objects)
end