aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job/performing.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2014-05-21 00:26:19 +0200
committerDouwe Maan <douwe@selenight.nl>2014-05-21 15:20:15 +0200
commita00df7ea6e3307f46aab3cee6a9124ae3b801eec (patch)
treea0d0fb6b513b7098dc5d4fc800a84fdbf6cca3fd /lib/active_job/performing.rb
parent4ad28b18672bbb369bdc446d72fdd829eeaecd88 (diff)
downloadrails-a00df7ea6e3307f46aab3cee6a9124ae3b801eec.tar.gz
rails-a00df7ea6e3307f46aab3cee6a9124ae3b801eec.tar.bz2
rails-a00df7ea6e3307f46aab3cee6a9124ae3b801eec.zip
Don't deserialize parameters in individual adapters.
It's not their responsibility and this makes logging (and rescuing from errors, eventually!) a lot easier.
Diffstat (limited to 'lib/active_job/performing.rb')
-rw-r--r--lib/active_job/performing.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/active_job/performing.rb b/lib/active_job/performing.rb
new file mode 100644
index 0000000000..6c304a4bed
--- /dev/null
+++ b/lib/active_job/performing.rb
@@ -0,0 +1,14 @@
+require 'active_job/parameters'
+
+module ActiveJob
+ module Performing
+ def perform_with_deserialization(*serialized_args)
+ ActiveSupport::Notifications.instrument "perform.active_job", adapter: self.class.queue_adapter, job: self.class, args: serialized_args
+ perform *Parameters.deserialize(serialized_args)
+ end
+
+ def perform(*)
+ raise NotImplementedError
+ end
+ end
+end