lib/maglev/utils/operations_queue.rb
# drains all operations. All operations will be ran, even if an error is raised by one of proceeding operations.
drains all operations. All operations will be ran, even if an error is raised by one of proceeding operations.
drains all operations . All operations will be ran even if an error is raised by one of proceeding operations .
def drain
      begin
        grouped = @operations.group_by {|_, val| val.first }
        grouped.keys.sort.each do |priority|
          group = grouped[priority]
          MagLev.logger.info "Draining queue priority #{priority} containing #{group.size} operations..."
          MagLev::Try.new(group).each do |key, block|
            MagLev.logger.info "Performing operation \"#{key}\""
            block.last.call
          end
        end
      ensure
        @operations = {}
      end
    end
def drain begin grouped = @operations . group_by { | _ , val | val . first } grouped . keys . sort . each do | priority | group = grouped [ priority ] MagLev . logger . info "Draining queue priority #{priority} containing #{group.size} operations..." MagLev :: Try . new ( group ) . each do | key , block | MagLev . logger . info "Performing operation \"#{key}\"" block . last . call end end ensure @operations = { } end end
drains all operations.
drains all operations .