This commit is contained in:
shoopea 2019-05-19 11:20:01 +08:00
parent 8c80e1dc87
commit 3e0370631e
2 changed files with 15 additions and 31 deletions

6
def.go
View File

@ -193,8 +193,7 @@ const (
objSubTypeJobWithdrawal = 604
objSubTypeJobGStock = 605
objSubTypeJobRescanMsg = 606
objSubTypeJobRescanMsgChild = 607
objSubTypeJobSetJobDone = 608
objSubTypeJobSetJobDone = 607
objSubTypeItemResource = 701
objSubTypeItemAlch = 702
objSubTypeItemMisc = 703
@ -209,8 +208,7 @@ const (
objJobPriority = 1
objJobPriorityRescanMsg = 2
objJobPriorityRescanChildMsg = 3
objJobPriorityRescanAllMsg = 4
objJobPriorityRescanAllMsg = 3
MQGetMsgWorkers = 12
MQCWMsgQueueSize = 100

20
job.go
View File

@ -18,23 +18,9 @@ func jobRescan(j Job) {
ids := getSQLListID64(r.Query)
if len(ids) > 1 {
for i := 1; i <= (len(ids)/SQLMsgRescanJobSize)+1; i++ {
var s string
for _, id := range ids[((i - 1) * SQLMsgRescanJobSize) : Min((i*SQLMsgRescanJobSize), len(ids))-1] {
s = s + fmt.Sprintf("SELECT %d id FROM DUAL UNION\n", id)
for _, id := range ids {
SQLMsgIdentifyQueue <- id
}
s = s + `SELECT 0 id FROM DUAL WHERE 1 = 2;`
p := JobPayloadRescanMsg{
Query: s,
MsgID64: 0,
ChatID64: 0,
}
b, _ := json.Marshal(p)
err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, j.UserID64, time.Now(), b)
logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)")
}
if j.JobTypeID == objSubTypeJobRescanMsg {
p := JobPayloadSetDone{
JobID64: j.ID64,
MsgID64: r.MsgID64,
@ -44,7 +30,7 @@ func jobRescan(j Job) {
b, _ := json.Marshal(p)
err := createJob(objSubTypeJobSetJobDone, objJobPriorityRescanAllMsg, j.UserID64, time.Now(), b)
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)")
}
} else if len(ids) == 1 {
SQLMsgIdentifyQueue <- ids[0]
err = setJobDone(j.ID64)