Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
26dc3ea7
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26dc3ea7
编写于
5月 22, 2014
作者:
D
David Heinemeier Hansson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename #perform_with_hooks to #execution
上级
ef4aff07
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
16 addition
and
16 deletion
+16
-16
lib/active_job/base.rb
lib/active_job/base.rb
+2
-2
lib/active_job/execution.rb
lib/active_job/execution.rb
+2
-2
lib/active_job/queue_adapters/backburner_adapter.rb
lib/active_job/queue_adapters/backburner_adapter.rb
+1
-1
lib/active_job/queue_adapters/delayed_job_adapter.rb
lib/active_job/queue_adapters/delayed_job_adapter.rb
+1
-1
lib/active_job/queue_adapters/inline_adapter.rb
lib/active_job/queue_adapters/inline_adapter.rb
+2
-2
lib/active_job/queue_adapters/que_adapter.rb
lib/active_job/queue_adapters/que_adapter.rb
+1
-1
lib/active_job/queue_adapters/queue_classic_adapter.rb
lib/active_job/queue_adapters/queue_classic_adapter.rb
+1
-1
lib/active_job/queue_adapters/resque_adapter.rb
lib/active_job/queue_adapters/resque_adapter.rb
+1
-1
lib/active_job/queue_adapters/sidekiq_adapter.rb
lib/active_job/queue_adapters/sidekiq_adapter.rb
+1
-1
lib/active_job/queue_adapters/sneakers_adapter.rb
lib/active_job/queue_adapters/sneakers_adapter.rb
+1
-1
lib/active_job/queue_adapters/sucker_punch_adapter.rb
lib/active_job/queue_adapters/sucker_punch_adapter.rb
+1
-1
test/cases/callbacks_test.rb
test/cases/callbacks_test.rb
+1
-1
test/cases/rescue_test.rb
test/cases/rescue_test.rb
+1
-1
未找到文件。
lib/active_job/base.rb
浏览文件 @
26dc3ea7
require
'active_job/queue_adapter'
require
'active_job/queue_name'
require
'active_job/enqueuing'
require
'active_job/
performing
'
require
'active_job/
execution
'
require
'active_job/logging'
require
'active_job/callbacks'
...
...
@@ -11,7 +11,7 @@ class Base
extend
QueueName
include
Enqueuing
include
Performing
include
Execution
include
Callbacks
include
Logging
...
...
lib/active_job/
performing
.rb
→
lib/active_job/
execution
.rb
浏览文件 @
26dc3ea7
...
...
@@ -2,14 +2,14 @@
require
'active_job/arguments'
module
ActiveJob
module
Performing
module
Execution
extend
ActiveSupport
::
Concern
included
do
include
ActiveSupport
::
Rescuable
end
def
perform_with_hooks
(
*
serialized_args
)
def
execute
(
*
serialized_args
)
self
.
arguments
=
Arguments
.
deserialize
(
serialized_args
)
run_callbacks
:perform
do
...
...
lib/active_job/queue_adapters/backburner_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -16,7 +16,7 @@ def enqueue_at(job, timestamp, *args)
class
JobWrapper
class
<<
self
def
perform
(
job_name
,
*
args
)
job_name
.
constantize
.
new
.
perform_with_hooks
*
args
job_name
.
constantize
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/delayed_job_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -15,7 +15,7 @@ def enqueue_at(job, timestamp, *args)
class
JobWrapper
def
perform
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/inline_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -3,7 +3,7 @@ module QueueAdapters
class
InlineAdapter
class
<<
self
def
enqueue
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
def
enqueue_at
(
job
,
timestamp
,
*
args
)
...
...
@@ -11,7 +11,7 @@ def enqueue_at(job, timestamp, *args)
begin
interval
=
Time
.
now
.
to_f
-
timestamp
sleep
(
interval
)
if
interval
>
0
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
rescue
=>
e
ActiveJob
::
Base
.
logger
.
info
"Error performing
#{
job
}
:
#{
e
.
message
}
"
end
...
...
lib/active_job/queue_adapters/que_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -15,7 +15,7 @@ def enqueue_at(job, timestamp, *args)
class
JobWrapper
<
Que
::
Job
def
run
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/queue_classic_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -15,7 +15,7 @@ def enqueue_at(job, timestamp, *args)
class
JobWrapper
def
self
.
perform
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/resque_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -19,7 +19,7 @@ def enqueue_at(job, timestamp, *args)
class
JobWrapper
class
<<
self
def
perform
(
job_name
,
*
args
)
job_name
.
constantize
.
new
.
perform_with_hooks
*
args
job_name
.
constantize
.
new
.
execute
*
args
end
end
...
...
lib/active_job/queue_adapters/sidekiq_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -26,7 +26,7 @@ class JobWrapper
include
Sidekiq
::
Worker
def
perform
(
job_name
,
*
args
)
job_name
.
constantize
.
new
.
perform_with_hooks
*
args
job_name
.
constantize
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/sneakers_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -23,7 +23,7 @@ class JobWrapper
include
Sneakers
::
Worker
def
work
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
end
end
...
...
lib/active_job/queue_adapters/sucker_punch_adapter.rb
浏览文件 @
26dc3ea7
...
...
@@ -17,7 +17,7 @@ class JobWrapper
include
SuckerPunch
::
Job
def
perform
(
job
,
*
args
)
job
.
new
.
perform_with_hooks
*
args
job
.
new
.
execute
*
args
end
end
end
...
...
test/cases/callbacks_test.rb
浏览文件 @
26dc3ea7
...
...
@@ -5,7 +5,7 @@
class
CallbacksTest
<
ActiveSupport
::
TestCase
test
'perform callbacks'
do
performed_callback_job
=
CallbackJob
.
new
.
tap
{
|
j
|
j
.
perform_with_hooks
}
performed_callback_job
=
CallbackJob
.
new
.
tap
{
|
j
|
j
.
execute
}
assert
"CallbackJob ran before_perform"
.
in?
performed_callback_job
.
history
assert
"CallbackJob ran after_perform"
.
in?
performed_callback_job
.
history
assert
"CallbackJob ran around_perform_start"
.
in?
performed_callback_job
.
history
...
...
test/cases/rescue_test.rb
浏览文件 @
26dc3ea7
...
...
@@ -10,7 +10,7 @@ class RescueTest < ActiveSupport::TestCase
test
'rescue perform exception with retry'
do
job
=
RescueJob
.
new
job
.
perform_with_hooks
(
"david"
)
job
.
execute
(
"david"
)
assert_equal
[
"rescued from StandardError"
,
"performed beautifully"
],
$BUFFER
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录