-
-
Save defunkt/186983 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
class SomeFastJob | |
@queue = :high | |
def self.perform | |
fast_stuff | |
end | |
end | |
class SomeSlowJob | |
@queue = :low | |
def self.perform | |
slow_stuff | |
end | |
end | |
module Job | |
extend self | |
def enqueue(klass, *args) | |
if live_queue? | |
Resque.enqueue(klass, *args) | |
else | |
klass.perform(*args) | |
end | |
end | |
def live_queue? | |
Merb.env =~ /production/ | |
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 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment