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
SQLCWMsgWorkers = 6
SQLIdentifyMsgWorkers = 6
SQLMsgIdentifyQueueSize = 1000
SQLMsgIdentifyQueueSize = 100
SQLMsgRescanJobSize = 25
SQLJobWorkers = 12
TGCmdWorkers = 3
TGCmdQueueSize = 100
MQTGCmdWorkers = 3
MQTGCmdQueueSize = 100
SQLJobSliceSize = 250
SQLJobSliceSize = 25
)
var (

52
job.go
View File

@ -18,9 +18,14 @@ func jobRescan(j Job) {
ids := getSQLListID64(r.Query)
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{
Query: fmt.Sprintf("SELECT %d id FROM DUAL;", id),
Query: s,
MsgID64: 0,
ChatID64: 0,
}
@ -28,6 +33,7 @@ func jobRescan(j Job) {
err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, j.UserID64, time.Now(), b)
logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)")
}
p := JobPayloadSetDone{
JobID64: j.ID64,
MsgID64: r.MsgID64,
@ -94,31 +100,31 @@ func jobSetDone(j Job) {
func jobPillage(j Job) {
/*
var r JobPayloadPillage
var r JobPayloadPillage
err := setJobStart(j.ID64)
logOnError(err, "jobPillage : setJobStart")
err := setJobStart(j.ID64)
logOnError(err, "jobPillage : setJobStart")
err = json.Unmarshal(j.Payload, &r)
logOnError(err, "jobPillage : Unmarshal payload")
err = json.Unmarshal(j.Payload, &r)
logOnError(err, "jobPillage : Unmarshal payload")
ids := getSQLListID64(` select og.id
from obj og
,obj_msg omg
,obj op
,obj_msg omp
,obj_job oj
where omg.obj_id = og.id
and og.obj_sub_type_id = ` + strconv.Itoa(objSubTypeMessageGo) `
and omg.user_id = oj.user_id
and omg.sender_user_id = oj.user_id
and oj.obj_id = ` + strconv.Itoa(j.ID64) `
and omp.obj_id = op.id
and op.id = ` + strconv.Itoa(r.ObjID64) `
and omg.date between omp.date and addtime(omp.date, '0 0:3:0.000000');`
ids := getSQLListID64(` select og.id
from obj og
,obj_msg omg
,obj op
,obj_msg omp
,obj_job oj
where omg.obj_id = og.id
and og.obj_sub_type_id = ` + strconv.Itoa(objSubTypeMessageGo) `
and omg.user_id = oj.user_id
and omg.sender_user_id = oj.user_id
and oj.obj_id = ` + strconv.Itoa(j.ID64) `
and omp.obj_id = op.id
and op.id = ` + strconv.Itoa(r.ObjID64) `
and omg.date between omp.date and addtime(omp.date, '0 0:3:0.000000');`
err = setJobStatus(j.ID64, objJobStatusPillageGo, time.Now().Add(5 * time.second))
logOnError(err, "jobPillage : setJobDone")
err = setJobStatus(j.ID64, objJobStatusPillageGo, time.Now().Add(5 * time.second))
logOnError(err, "jobPillage : setJobDone")
*/
return
}