test
This commit is contained in:
parent
0e72a8f118
commit
776c5949c2
16
job.go
16
job.go
@ -151,12 +151,12 @@ func loadCurrentJobs() ([]Job, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func jobRescan(j Job) {
|
func jobRescan(j Job) {
|
||||||
var r JobPayloadRescanMsg
|
var p JobPayloadRescanMsg
|
||||||
|
|
||||||
err := setJobStart(j.ID64)
|
err := setJobStart(j.ID64)
|
||||||
logOnError(err, "jobRescan : setJobStart")
|
logOnError(err, "jobRescan : setJobStart")
|
||||||
|
|
||||||
err = json.Unmarshal(j.Payload, &r)
|
err = json.Unmarshal(j.Payload, &p)
|
||||||
logOnError(err, "jobRescan : Unmarshal payload")
|
logOnError(err, "jobRescan : Unmarshal payload")
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
@ -180,10 +180,10 @@ func jobRescan(j Job) {
|
|||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if time.Now().After(milestone.Add(1 * time.Minute)) {
|
if time.Now().After(milestone.Add(1 * time.Minute)) {
|
||||||
txt := fmt.Sprintf("Rescanned %d/%d messages.", i, len(ids))
|
//txt := fmt.Sprintf("Rescanned %d/%d messages.", i, len(ids))
|
||||||
m = TGCommand{
|
m = TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
Text: txt,
|
Text: fmt.Sprintf("Rescanned %d/%d messages.", i, len(ids)),
|
||||||
FromMsgID64: p.MsgID64,
|
FromMsgID64: p.MsgID64,
|
||||||
FromChatID64: p.ChatID64,
|
FromChatID64: p.ChatID64,
|
||||||
}
|
}
|
||||||
@ -193,13 +193,13 @@ func jobRescan(j Job) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p := JobPayloadSetDone{
|
r := JobPayloadSetDone{
|
||||||
JobID64: j.ID64,
|
JobID64: j.ID64,
|
||||||
MsgID64: r.MsgID64,
|
MsgID64: p.MsgID64,
|
||||||
ChatID64: r.ChatID64,
|
ChatID64: p.ChatID64,
|
||||||
Text: fmt.Sprintf("%d messages processed in %s.", len(ids), time.Since(start)),
|
Text: fmt.Sprintf("%d messages processed in %s.", len(ids), time.Since(start)),
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(r)
|
||||||
_, err := createJob(objSubTypeJobSetJobDone, objJobPriorityRescanAllMsg, j.UserID64, time.Now().UTC(), b)
|
_, err := createJob(objSubTypeJobSetJobDone, objJobPriorityRescanAllMsg, j.UserID64, time.Now().UTC(), b)
|
||||||
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)")
|
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user