File tree Expand file tree Collapse file tree 3 files changed +23
-24
lines changed
activerecord/lib/active_record/railties Expand file tree Collapse file tree 3 files changed +23
-24
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ def instrument_job(event)
315
315
end
316
316
317
317
def instrument ( event , payload = { } )
318
- job . send ( : instrument, event , **payload )
318
+ job . instrument event , **payload
319
319
end
320
320
end
321
321
end
Original file line number Diff line number Diff line change @@ -26,24 +26,24 @@ def perform_now
26
26
instrument ( :perform ) { super }
27
27
end
28
28
29
+ def instrument ( operation , payload = { } , &block ) # :nodoc:
30
+ payload [ :job ] = self
31
+ payload [ :adapter ] = queue_adapter
32
+
33
+ ActiveSupport ::Notifications . instrument ( "#{ operation } .active_job" , payload ) do
34
+ value = block . call if block
35
+ payload [ :aborted ] = @_halted_callback_hook_called if defined? ( @_halted_callback_hook_called )
36
+ @_halted_callback_hook_called = nil
37
+ value
38
+ end
39
+ end
40
+
29
41
private
30
42
def _perform_job
31
43
instrument ( :perform_start )
32
44
super
33
45
end
34
46
35
- def instrument ( operation , payload = { } , &block )
36
- payload [ :job ] = self
37
- payload [ :adapter ] = queue_adapter
38
-
39
- ActiveSupport ::Notifications . instrument ( "#{ operation } .active_job" , payload ) do
40
- value = block . call if block
41
- payload [ :aborted ] = @_halted_callback_hook_called if defined? ( @_halted_callback_hook_called )
42
- @_halted_callback_hook_called = nil
43
- value
44
- end
45
- end
46
-
47
47
def halted_callback_hook ( *)
48
48
super
49
49
@_halted_callback_hook_called = true
Original file line number Diff line number Diff line change 5
5
module ActiveRecord
6
6
module Railties # :nodoc:
7
7
module JobRuntime # :nodoc:
8
- private
9
- def instrument ( operation , payload = { } , &block )
10
- if operation == :perform && block
11
- super ( operation , payload ) do
12
- db_runtime_before_perform = ActiveRecord ::RuntimeRegistry . sql_runtime
13
- result = block . call
14
- payload [ :db_runtime ] = ActiveRecord ::RuntimeRegistry . sql_runtime - db_runtime_before_perform
15
- result
16
- end
17
- else
18
- super
8
+ def instrument ( operation , payload = { } , &block ) # :nodoc:
9
+ if operation == :perform && block
10
+ super ( operation , payload ) do
11
+ db_runtime_before_perform = ActiveRecord ::RuntimeRegistry . sql_runtime
12
+ result = block . call
13
+ payload [ :db_runtime ] = ActiveRecord ::RuntimeRegistry . sql_runtime - db_runtime_before_perform
14
+ result
19
15
end
16
+ else
17
+ super
20
18
end
19
+ end
21
20
end
22
21
end
23
22
end
You can’t perform that action at this time.
0 commit comments