Last active
August 9, 2016 05:09
-
-
Save codesoda/30129db11f65401f6cb2e872f48d44c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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