This commit is contained in:
shoopea 2019-05-11 13:06:40 +08:00
parent 9036623075
commit e846045eaa

20
job.go
View File

@ -7,11 +7,16 @@ import (
) )
func jobRescan(j Job) { func jobRescan(j Job) {
var r JobPayloadRescanMsg
err := setJobStart(j.ID64) err := setJobStart(j.ID64)
logOnError(err, "jobRescan : setJobStart") logOnError(err, "jobRescan : setJobStart")
r := JobPayloadRescanMsg{}
err = json.Unmarshal(j.Payload, &r) err = json.Unmarshal(j.Payload, &r)
logOnError(err, "jobRescan : Unmarshal payload")
ids := getSQLListID64(r.Query) ids := getSQLListID64(r.Query)
if len(ids) > 1 { if len(ids) > 1 {
for _, id := range ids { for _, id := range ids {
p := JobPayloadRescanMsg{} p := JobPayloadRescanMsg{}
@ -29,19 +34,28 @@ func jobRescan(j Job) {
} else if len(ids) == 1 { } else if len(ids) == 1 {
SQLMsgIdentifyQueue <- ids[0] SQLMsgIdentifyQueue <- ids[0]
err = setJobDone(j.ID64) err = setJobDone(j.ID64)
logOnError(err, "jobRescan : setJobDone") logOnError(err, "jobRescan : setJobDone(1)")
} else {
err = setJobDone(j.ID64)
logOnError(err, "jobRescan : setJobDone(0)")
} }
return return
} }
func jobSetDone(j Job) { func jobSetDone(j Job) {
var r JobPayloadSetDone
err := setJobStart(j.ID64) err := setJobStart(j.ID64)
logOnError(err, "jobSetDone : setJobStart") logOnError(err, "jobSetDone : setJobStart")
r := JobPayloadSetDone{}
err = json.Unmarshal(j.Payload, &r) err = json.Unmarshal(j.Payload, &r)
logOnError(err, "jobSetDone : Unmarshal payload")
err = setJobDone(r.JobID64) err = setJobDone(r.JobID64)
logOnError(err, "jobSetDone : setJobDone(child)") logOnError(err, "jobSetDone : setJobDone(child)")
err = setJobDone(j.ID64) err = setJobDone(j.ID64)
logOnError(err, "jobSetDone : setJobDone") logOnError(err, "jobSetDone : setJobDone")
return return
} }