This commit is contained in:
shoopea 2019-05-19 10:54:34 +08:00
parent 50942892bc
commit 96bf2b8de7
2 changed files with 32 additions and 25 deletions

5
def.go
View File

@ -215,13 +215,14 @@ const (
MQCWMsgQueueSize = 100 MQCWMsgQueueSize = 100
SQLCWMsgWorkers = 6 SQLCWMsgWorkers = 6
SQLIdentifyMsgWorkers = 6 SQLIdentifyMsgWorkers = 6
SQLMsgIdentifyQueueSize = 1000 SQLMsgIdentifyQueueSize = 100
SQLMsgRescanJobSize = 25
SQLJobWorkers = 12 SQLJobWorkers = 12
TGCmdWorkers = 3 TGCmdWorkers = 3
TGCmdQueueSize = 100 TGCmdQueueSize = 100
MQTGCmdWorkers = 3 MQTGCmdWorkers = 3
MQTGCmdQueueSize = 100 MQTGCmdQueueSize = 100
SQLJobSliceSize = 250 SQLJobSliceSize = 25
) )
var ( var (

10
job.go
View File

@ -18,9 +18,14 @@ func jobRescan(j Job) {
ids := getSQLListID64(r.Query) ids := getSQLListID64(r.Query)
if len(ids) > 1 { if len(ids) > 1 {
for _, id := range ids { for i := 1; i <= (len(ids)/SQLMsgRescanJobSize)+1; i++ {
var s string
for _, id := range ids[((i - 1) * SQLMsgRescanJobSize):(i*SQLMsgRescanJobSize - 1)] {
s = s + fmp.Sprintf("SELECT %d id FROM DUAL UNION\n", id)
}
s = s + fmp.Sprintf("SELECT 0 id FROM DUAL WHERE 1 = 2;", id)
p := JobPayloadRescanMsg{ p := JobPayloadRescanMsg{
Query: fmt.Sprintf("SELECT %d id FROM DUAL;", id), Query: s,
MsgID64: 0, MsgID64: 0,
ChatID64: 0, ChatID64: 0,
} }
@ -28,6 +33,7 @@ func jobRescan(j Job) {
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)")
} }
p := JobPayloadSetDone{ p := JobPayloadSetDone{
JobID64: j.ID64, JobID64: j.ID64,
MsgID64: r.MsgID64, MsgID64: r.MsgID64,