test
This commit is contained in:
parent
d9bec92c80
commit
75a8371d49
15
job.go
15
job.go
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,8 +88,8 @@ func rescheduleJob(jobID64 int64, schedule time.Time) error {
|
|||||||
}
|
}
|
||||||
defer stmt.Close()
|
defer stmt.Close()
|
||||||
|
|
||||||
_, err = stmt.Exec(time.Now(), jobId)
|
_, err = stmt.Exec(time.Now(), jobID64)
|
||||||
s := fmt.Sprintf("rescheduleJob, update obj_job(%d)", jobId)
|
s := fmt.Sprintf("rescheduleJob, update obj_job(%d)", jobID64)
|
||||||
logOnError(err, s)
|
logOnError(err, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -246,7 +247,7 @@ func jobPillage(j Job) {
|
|||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("More than one outcome for pillage #%d", r.ObjID64),
|
Text: fmt.Sprintf("More than one outcome for pillage #%d", r.ObjID64),
|
||||||
ToUserID64: m.UserID64,
|
ToUserID64: j.UserID64,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- s
|
TGCmdQueue <- s
|
||||||
} else if len(ids) == 1 { // we've got a match, job is done whether we prevented the pillage or not
|
} else if len(ids) == 1 { // we've got a match, job is done whether we prevented the pillage or not
|
||||||
@ -261,21 +262,21 @@ func jobPillage(j Job) {
|
|||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("We avoided a pillage (%s)", m.Date.Format(time.RFC3339)),
|
Text: fmt.Sprintf("We avoided a pillage (%s)", m.Date.Format(time.RFC3339)),
|
||||||
ToUserID64: m.UserID64,
|
ToUserID64: j.UserID64,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- s
|
TGCmdQueue <- s
|
||||||
} else if msgTypeId == objSubTypeMessagePillageTimeout {
|
} else if msgTypeId == objSubTypeMessagePillageTimeout {
|
||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("We got pillaged (%s)", m.Date.Format(time.RFC3339)),
|
Text: fmt.Sprintf("We got pillaged (%s)", m.Date.Format(time.RFC3339)),
|
||||||
ToUserID64: m.UserID64,
|
ToUserID64: j.UserID64,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- s
|
TGCmdQueue <- s
|
||||||
} else {
|
} else {
|
||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("We don't know what happened (%s)", m.Date.Format(time.RFC3339)),
|
Text: fmt.Sprintf("We don't know what happened (%s)", m.Date.Format(time.RFC3339)),
|
||||||
ToUserID64: m.UserID64,
|
ToUserID64: j.UserID64,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- s
|
TGCmdQueue <- s
|
||||||
}
|
}
|
||||||
@ -306,7 +307,7 @@ func jobPillage(j Job) {
|
|||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("We started intercepting the pillage (%s)", m.Date.Format(time.RFC3339)),
|
Text: fmt.Sprintf("We started intercepting the pillage (%s)", m.Date.Format(time.RFC3339)),
|
||||||
ToUserID64: m.UserID64,
|
ToUserID64: j.UserID64,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- s
|
TGCmdQueue <- s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user