Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xxl-job-executor-go
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xxl-job-executor-go
Commits
c95efefe
提交
c95efefe
authored
9月 26, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
8cf1f45f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
executor.go
executor.go
+10
-10
没有找到文件。
executor.go
浏览文件 @
c95efefe
...
@@ -240,7 +240,7 @@ func (e *executor) idleBeat(writer http.ResponseWriter, request *http.Request) {
...
@@ -240,7 +240,7 @@ func (e *executor) idleBeat(writer http.ResponseWriter, request *http.Request) {
err
:=
json
.
Unmarshal
(
req
,
&
param
)
err
:=
json
.
Unmarshal
(
req
,
&
param
)
if
err
!=
nil
{
if
err
!=
nil
{
_
,
_
=
writer
.
Write
(
returnIdleBeat
(
FailureCode
))
_
,
_
=
writer
.
Write
(
returnIdleBeat
(
FailureCode
))
e
.
log
.
Error
(
"
参数解析错误
:"
+
string
(
req
))
e
.
log
.
Error
(
"
parse params fail
:"
+
string
(
req
))
return
return
}
}
if
e
.
runList
.
Exists
(
Int64ToStr
(
param
.
JobID
))
{
if
e
.
runList
.
Exists
(
Int64ToStr
(
param
.
JobID
))
{
...
@@ -261,10 +261,10 @@ func (e *executor) registry() {
...
@@ -261,10 +261,10 @@ func (e *executor) registry() {
}
}
param
,
err
:=
json
.
Marshal
(
req
)
param
,
err
:=
json
.
Marshal
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
"
执行器注册信息解析失败
:"
+
err
.
Error
())
log
.
Fatal
(
"
parse executor registry info fail
:"
+
err
.
Error
())
}
}
if
e
.
keepBeat
(
param
)
{
if
e
.
keepBeat
(
param
)
{
e
.
log
.
Info
(
"connect
registry
success"
)
e
.
log
.
Info
(
"connect
scheduling center
success"
)
}
}
t
:=
time
.
NewTicker
(
time
.
Second
*
20
)
t
:=
time
.
NewTicker
(
time
.
Second
*
20
)
defer
t
.
Stop
()
defer
t
.
Stop
()
...
@@ -278,19 +278,19 @@ func (e *executor) keepBeat(param []byte) bool {
...
@@ -278,19 +278,19 @@ func (e *executor) keepBeat(param []byte) bool {
ok
:=
false
ok
:=
false
result
,
err
:=
e
.
post
(
"/api/registry"
,
string
(
param
))
result
,
err
:=
e
.
post
(
"/api/registry"
,
string
(
param
))
if
err
!=
nil
{
if
err
!=
nil
{
e
.
log
.
Error
(
"
connect registry
fail[1]:"
+
err
.
Error
())
e
.
log
.
Error
(
"
executor connect scheduling center
fail[1]:"
+
err
.
Error
())
return
ok
return
ok
}
}
defer
result
.
Body
.
Close
()
defer
result
.
Body
.
Close
()
body
,
err
:=
io
.
ReadAll
(
result
.
Body
)
body
,
err
:=
io
.
ReadAll
(
result
.
Body
)
if
err
!=
nil
{
if
err
!=
nil
{
e
.
log
.
Error
(
"
connect registry
fail[2]:"
+
err
.
Error
())
e
.
log
.
Error
(
"
executor connect scheduling center
fail[2]:"
+
err
.
Error
())
return
ok
return
ok
}
}
res
:=
&
res
{}
res
:=
&
res
{}
_
=
json
.
Unmarshal
(
body
,
&
res
)
_
=
json
.
Unmarshal
(
body
,
&
res
)
if
res
.
Code
!=
SuccessCode
{
if
res
.
Code
!=
SuccessCode
{
e
.
log
.
Error
(
"
connect registry
fail[3]:"
+
string
(
body
))
e
.
log
.
Error
(
"
executor connect scheduling center
fail[3]:"
+
string
(
body
))
return
ok
return
ok
}
}
return
true
return
true
...
@@ -307,17 +307,17 @@ func (e *executor) registryRemove() {
...
@@ -307,17 +307,17 @@ func (e *executor) registryRemove() {
}
}
param
,
err
:=
json
.
Marshal
(
req
)
param
,
err
:=
json
.
Marshal
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
e
.
log
.
Error
(
"
执行器移除失败
:"
+
err
.
Error
())
e
.
log
.
Error
(
"
remove executor fail
:"
+
err
.
Error
())
return
return
}
}
res
,
err
:=
e
.
post
(
"/api/registryRemove"
,
string
(
param
))
res
,
err
:=
e
.
post
(
"/api/registryRemove"
,
string
(
param
))
if
err
!=
nil
{
if
err
!=
nil
{
e
.
log
.
Error
(
"
执行器移除失败
:"
+
err
.
Error
())
e
.
log
.
Error
(
"
remove executor fail
:"
+
err
.
Error
())
return
return
}
}
defer
res
.
Body
.
Close
()
defer
res
.
Body
.
Close
()
body
,
_
:=
io
.
ReadAll
(
res
.
Body
)
body
,
_
:=
io
.
ReadAll
(
res
.
Body
)
e
.
log
.
Info
(
"
执行器移除成功
:"
+
string
(
body
))
e
.
log
.
Info
(
"
remove executor success
:"
+
string
(
body
))
}
}
// 回调任务列表
// 回调任务列表
...
@@ -330,7 +330,7 @@ func (e *executor) callback(task *Task, code int64, msg string) {
...
@@ -330,7 +330,7 @@ func (e *executor) callback(task *Task, code int64, msg string) {
}
}
defer
res
.
Body
.
Close
()
defer
res
.
Body
.
Close
()
body
,
_
:=
io
.
ReadAll
(
res
.
Body
)
body
,
_
:=
io
.
ReadAll
(
res
.
Body
)
e
.
log
.
Info
(
"
任务回调成功
:"
+
string
(
body
))
e
.
log
.
Info
(
"
job callback success
:"
+
string
(
body
))
}
}
// post
// post
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论