aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Somerville <charlie@charliesomerville.com>2014-05-19 01:27:50 +1000
committerCharlie Somerville <charlie@charliesomerville.com>2014-05-19 01:27:50 +1000
commit2ac1a021025ad4f5f85368b9a85dcf210e5797d6 (patch)
tree577c7e9aa54a429f8f5694110341888db94752c8
parentb32fdd5731aa0a6b8ed77305f78aba17a730b8e8 (diff)
downloadrails-2ac1a021025ad4f5f85368b9a85dcf210e5797d6.tar.gz
rails-2ac1a021025ad4f5f85368b9a85dcf210e5797d6.tar.bz2
rails-2ac1a021025ad4f5f85368b9a85dcf210e5797d6.zip
Clean up JobWrappers::ResqueWrapper.perform
This is not only easier to read, but it'll also properly raise an ArgumentError rather than a NoMethodError when called with no arguments. It also allocates 4 fewer objects per call (8 down from 12), and is about 50% faster according to a quick benchmark.
-rw-r--r--lib/active_job/job_wrappers/resque_wrapper.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/active_job/job_wrappers/resque_wrapper.rb b/lib/active_job/job_wrappers/resque_wrapper.rb
index c34ea99f3c..0db9cf144f 100644
--- a/lib/active_job/job_wrappers/resque_wrapper.rb
+++ b/lib/active_job/job_wrappers/resque_wrapper.rb
@@ -13,14 +13,8 @@ module ActiveJob
[ new(job), *args.prepend(job) ]
end
- def perform(*args)
- unwrapped_job = args.first.constantize
-
- if args.many?
- unwrapped_job.perform *args.from(1)
- else
- unwrapped_job.perform
- end
+ def perform(job_name, *args)
+ job_name.constantize.perform(*args)
end
end
@@ -34,4 +28,4 @@ module ActiveJob
end
end
end
-end \ No newline at end of file
+end