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