Sha256: 754c0256b241e74575d1f42dc90b68ff29b0a0e42d5e1b66a14d0dc82c59aa67

Contents?: true

Size: 641 Bytes

Versions: 28

Compression:

Stored size: 641 Bytes

Contents

# This is a simple Resque job.
class Archive
  @queue = :file_serve

  def self.perform(repo_id, branch = 'master')
    repo = Repository.find(repo_id)
    repo.create_archive(branch)
  end
end

# This is in our app code
class Repository < Model
  # ... stuff ...

  def async_create_archive(branch)
    Resque.enqueue(Archive, self.id, branch)
  end

  # ... more stuff ...
end

# Calling this code:
repo = Repository.find(22)
repo.async_create_archive('homebrew')

# Will return immediately and create a Resque job which is later
# processed.

# Essentially, this code is run by the worker when processing:
Archive.perform(22, 'homebrew')

Version data entries

28 entries across 28 versions & 6 rubygems

Version Path
opengotham_resque-1.8.2 examples/simple.rb
resque-mongo-1.8.1 examples/simple.rb
resque-1.8.0 examples/simple.rb
resque-1.7.1 examples/simple.rb
resque-1.7.0 examples/simple.rb
resque-1.6.1 examples/simple.rb
resque-1.6.0 examples/simple.rb
resque-1.5.2 examples/simple.rb
resque-1.5.1 examples/simple.rb
scotttam-resque-0.0.5 examples/simple.rb
scotttam-resque-0.0.4 examples/simple.rb
scotttam-resque-0.0.3 examples/simple.rb
scotttam-resque-0.0.2 examples/simple.rb
scotttam-resque-0.0.1 examples/simple.rb
grockit-resque-1.5.0 examples/simple.rb
resque-1.5.0 examples/simple.rb
resque-mongo-1.4.0 examples/simple.rb
resque-1.4.0 examples/simple.rb
resque-mongo-1.3.1 examples/simple.rb
resque-1.3.1 examples/simple.rb