Skip to content

Instantly share code, notes, and snippets.

@codesoda
Last active August 9, 2016 05:09
Show Gist options
  • Save codesoda/30129db11f65401f6cb2e872f48d44c2 to your computer and use it in GitHub Desktop.
Save codesoda/30129db11f65401f6cb2e872f48d44c2 to your computer and use it in GitHub Desktop.
# this is running in Project 2
class MyClass
def some_process
# if the worker was in this project I could do this
# MyWorker.perform_async(...args)
# but the worker isn't in my project
# I always thought I could do this, but it seems it needs
# class: ActualClass,
# not
# class: 'ClassName'
Sidekiq::Client.push({
class: 'BuildStepWorker',
args: [ build.id, key ]
})
# see https://github.com/mperham/sidekiq/blob/776e69d631092e0c6ffe3130764634666aa062e5/lib/sidekiq/client.rb
# Alternatively I'll just jump in and use RabbitMQ for background tasks
end
end
# this is running in Project 1
class MyWorker
include Sidekiq::Worker
def perform(name, count)
# do something
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment