test
This commit is contained in:
parent
014bcb7873
commit
5aff9b0bd3
2
def.go
2
def.go
@ -319,7 +319,7 @@ type BotMsg struct {
|
||||
|
||||
type Job struct {
|
||||
ID64 int64
|
||||
JobTypeID int32
|
||||
JobTypeID64 int64
|
||||
Trigger int64
|
||||
Timeout time.Time
|
||||
UserID64 int64
|
||||
|
6
job.go
6
job.go
@ -154,7 +154,7 @@ func rescheduleJob(jobID64 int64, trigger int64, schedule time.Time) error {
|
||||
func loadCurrentJobs() ([]Job, error) {
|
||||
var (
|
||||
objId int64
|
||||
jobTypeId int32
|
||||
jobTypeID64 int64
|
||||
userID64 int64
|
||||
trigger int64
|
||||
timeout time.Time
|
||||
@ -187,11 +187,11 @@ func loadCurrentJobs() ([]Job, error) {
|
||||
}
|
||||
|
||||
for rows.Next() {
|
||||
err = rows.Scan(&objId, &jobTypeId, &trigger, &userID64, &payload, &timeout)
|
||||
err = rows.Scan(&objId, &jobTypeID64, &trigger, &userID64, &payload, &timeout)
|
||||
logOnError(err, "loadCurrentJobs : scan query rows")
|
||||
job := Job{
|
||||
ID64: objId,
|
||||
JobTypeID: jobTypeId,
|
||||
JobTypeID64: jobTypeID64,
|
||||
Trigger: trigger,
|
||||
UserID64: userID64,
|
||||
Payload: payload,
|
||||
|
@ -548,7 +548,7 @@ func JobWorker(id int, jobs <-chan Job) {
|
||||
for j := range jobs {
|
||||
//log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339))
|
||||
if time.Now().UTC().Before(j.Timeout) {
|
||||
switch j.JobTypeID {
|
||||
switch j.JobTypeID64 {
|
||||
case cacheObjSubType[`job_rescan_msg`]:
|
||||
jobRescan(j)
|
||||
case cacheObjSubType[`job_set_done`]:
|
||||
@ -582,7 +582,7 @@ func JobWorker(id int, jobs <-chan Job) {
|
||||
case cacheObjSubType[`job_get_hammer_time`]:
|
||||
jobGetHammerTime(j)
|
||||
default:
|
||||
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)
|
||||
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID64)
|
||||
}
|
||||
} else {
|
||||
log.Printf("JobWorker[%d] : Job %d timed out.\n", id, j.ID64)
|
||||
|
Loading…
Reference in New Issue
Block a user