This commit is contained in:
shoopea 2019-05-16 11:06:38 +08:00
parent 57f91afe32
commit d6792bb2a2

11
job.go
View File

@ -20,9 +20,10 @@ func jobRescan(j Job) {
if len(ids) > 1 { if len(ids) > 1 {
for _, id := range ids { for _, id := range ids {
p := JobPayloadRescanMsg{ p := JobPayloadRescanMsg{
Query: fmt.Sprintf("SELECT o.id FROM obj o WHERE o.id = %d AND o.obj_type_id = %d AND o.obj_sub_type_id = %d;", id, objTypeMessage, objSubTypeMessageUnknown), Query: fmt.Sprintf("SELECT %id id FROM DUAL;", id),
MsgID64: 0,
ChatID64: 0,
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, j.UserID64, time.Now(), b) err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, j.UserID64, time.Now(), b)
logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)") logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)")
@ -40,6 +41,7 @@ func jobRescan(j Job) {
SQLMsgIdentifyQueue <- ids[0] SQLMsgIdentifyQueue <- ids[0]
err = setJobDone(j.ID64) err = setJobDone(j.ID64)
logOnError(err, "jobRescan : setJobDone(1)") logOnError(err, "jobRescan : setJobDone(1)")
if r.MsgID64 != 0 || r.ChatID64 != 0 {
m := TGCommand{ m := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
Text: "One message processed.", Text: "One message processed.",
@ -47,17 +49,20 @@ func jobRescan(j Job) {
FromChatID64: r.ChatID64, FromChatID64: r.ChatID64,
} }
TGCmdQueue <- m TGCmdQueue <- m
}
} else { } else {
err = setJobDone(j.ID64) err = setJobDone(j.ID64)
logOnError(err, "jobRescan : setJobDone(0)") logOnError(err, "jobRescan : setJobDone(0)")
if r.MsgID64 != 0 || r.ChatID64 != 0 {
m := TGCommand{ m := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
Text: "No message processed.", Text: "One message processed.",
FromMsgID64: r.MsgID64, FromMsgID64: r.MsgID64,
FromChatID64: r.ChatID64, FromChatID64: r.ChatID64,
} }
TGCmdQueue <- m TGCmdQueue <- m
} }
}
return return
} }