Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
go-crontab
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9f8efc75
authored
May 13, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整删除接口参数
parent
38d5b952
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
master/ApiServer.go
master/JobMgr.go
master/ApiServer.go
View file @
9f8efc75
...
...
@@ -66,7 +66,7 @@ ERR:
func
handleJobDelete
(
resp
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
var
(
err
error
// interface{}
job_name
string
job_
etcd_
name
string
node
string
oldJob
*
common
.
Job
bytes
[]
byte
...
...
@@ -78,11 +78,11 @@ func handleJobDelete(resp http.ResponseWriter, req *http.Request) {
}
// 删除的任务名、节点
job_
name
=
req
.
PostForm
.
Get
(
"job
_name"
)
job_
etcd_name
=
req
.
PostForm
.
Get
(
"job_etcd
_name"
)
node
=
req
.
PostForm
.
Get
(
"node"
)
// 去删除任务
if
oldJob
,
err
=
G_jobMgr
.
DeleteJob
(
job_name
,
node
);
err
!=
nil
{
if
oldJob
,
err
=
G_jobMgr
.
DeleteJob
(
job_
etcd_
name
,
node
);
err
!=
nil
{
goto
ERR
}
...
...
master/JobMgr.go
View file @
9f8efc75
...
...
@@ -168,7 +168,7 @@ func (jobMgr *JobMgr) SaveJob(req *http.Request) (oldJob *common.Job, err error)
}
// 删除任务
func
(
jobMgr
*
JobMgr
)
DeleteJob
(
job_name
string
,
node_ip
string
)
(
oldJob
*
common
.
Job
,
err
error
)
{
func
(
jobMgr
*
JobMgr
)
DeleteJob
(
job_
etcd_
name
string
,
node_ip
string
)
(
oldJob
*
common
.
Job
,
err
error
)
{
var
(
jobKey
string
delResp
*
clientv3
.
DeleteResponse
...
...
@@ -176,7 +176,7 @@ func (jobMgr *JobMgr) DeleteJob(job_name string, node_ip string) (oldJob *common
)
// etcd中保存任务的key
jobKey
=
common
.
JOB_SAVE_DIR
+
node_ip
+
"/"
+
job_name
jobKey
=
common
.
JOB_SAVE_DIR
+
node_ip
+
"/"
+
job_
etcd_
name
// 从etcd中删除它
if
delResp
,
err
=
jobMgr
.
kv
.
Delete
(
context
.
TODO
(),
jobKey
,
clientv3
.
WithPrevKV
());
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment