Last active
August 29, 2015 13:57
-
-
Save eccyan/9755592 to your computer and use it in GitHub Desktop.
Resque の Worker 毎に Redis のホストを設定する ref: http://qiita.com/eccyan/items/c10b4b0080c235b65976
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
require 'worker_base' | |
class Worker < WorkerBase | |
@redis = OTHER_REDIS_HOST | |
# ... | |
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
class WorkerBase | |
def self.before_enqueue(*args) | |
Resque.redis = @redis if @redis | |
end | |
def self.after_enqueue(*args) | |
Resque.redis = DEFAULT_REDIS_HOST | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment