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

33
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,23 +41,27 @@ 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)")
m := TGCommand{ if r.MsgID64 != 0 || r.ChatID64 != 0 {
Type: commandReplyMsg, m := TGCommand{
Text: "One message processed.", Type: commandReplyMsg,
FromMsgID64: r.MsgID64, Text: "One message processed.",
FromChatID64: r.ChatID64, FromMsgID64: r.MsgID64,
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)")
m := TGCommand{ if r.MsgID64 != 0 || r.ChatID64 != 0 {
Type: commandReplyMsg, m := TGCommand{
Text: "No message processed.", Type: commandReplyMsg,
FromMsgID64: r.MsgID64, Text: "One message processed.",
FromChatID64: r.ChatID64, FromMsgID64: r.MsgID64,
FromChatID64: r.ChatID64,
}
TGCmdQueue <- m
} }
TGCmdQueue <- m
} }
return return
} }