Sha256: 71d3dd5ceb78f2e1b1429c6a7f061f9d89737645737607f7b769d1a8b9f5f39d

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

module Tasks
  include RCelery::TaskSupport

  task(:name => 'r_celery.integration.subtract', :ignore_result => false)
  def subtract(a,b)
    a - b
  end

  task(:name => 'r_celery.integration.multiply', :ignore_result => false)
  def multiply(a,b)
    a * b
  end

  task(:name => 'r_celery.integration.add', :ignore_result => false)
  def add(a,b)
    a + b
  end

  task(:name => 'r_celery.integration.sleep', :ignore_result => false)
  def sleeper(t)
    sleep(t.to_i)
    'FINISH'
  end

  task(:name => 'r_celery.integration.retry', :ignore_result => false)
  def retrier(retries = 0)
    retrier.retry(:args => [retries-1], :eta => Time.now)  unless retries.zero?
    'FINISH'
  end

  task(:name => 'r_celery.integration.noop_retry', :ignore_result => false)
  def noop_retry(a)
    noop_retry.retry(:eta => Time.now)
  rescue RCelery::Task::MaxRetriesExceededError
    a
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcelery-1.0.1 spec/integration/tasks.rb
rcelery-1.0.0 spec/integration/tasks.rb