update timed out jobs
This commit is contained in:
parent
bb14f6a1cf
commit
0d50ea9ed4
10
job.go
10
job.go
@ -770,35 +770,35 @@ func jobGDeposit(j Job) {
|
||||
if res {
|
||||
log.Printf("jobGDeposit : Sending res.\n")
|
||||
clientSendCWMsgDelay(p.ChatID64, `📦Resources`, delay)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 10*time.Second)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, (10+delay)*time.Second)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2
|
||||
}
|
||||
if alch {
|
||||
log.Printf("jobGDeposit : Sending alch.\n")
|
||||
clientSendCWMsgDelay(p.ChatID64, `⚗️Alchemy`, delay)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 10*time.Second)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, (10+delay)*time.Second)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2
|
||||
}
|
||||
if misc {
|
||||
log.Printf("jobGDeposit : Sending misc.\n")
|
||||
clientSendCWMsgDelay(p.ChatID64, `🗃Misc`, delay)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 10*time.Second)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, (10+delay)*time.Second)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2
|
||||
}
|
||||
if craft {
|
||||
log.Printf("jobGDeposit : Sending craft.\n")
|
||||
clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 10*time.Second)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, (10+delay)*time.Second)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2
|
||||
}
|
||||
if equip {
|
||||
log.Printf("jobGDeposit : Sending equip.\n")
|
||||
clientSendCWMsgDelay(p.ChatID64, `🏷Equipment`, delay)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 10*time.Second)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, (10+delay)*time.Second)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2
|
||||
}
|
||||
|
47
workers.go
47
workers.go
@ -514,27 +514,32 @@ func JobWorker(id int, jobs <-chan Job) {
|
||||
// FIXME : discard timed out jobs
|
||||
for j := range jobs {
|
||||
//log.Printf("JobWorker[%d] : Starting job %d.\n", id, j.ID64)
|
||||
switch j.JobTypeID {
|
||||
case objSubTypeJobRescanMsg:
|
||||
jobRescan(j)
|
||||
case objSubTypeJobSetJobDone:
|
||||
jobSetDone(j)
|
||||
case objSubTypeJobPillage:
|
||||
jobPillage(j)
|
||||
case objSubTypeJobMsgClient:
|
||||
jobMsgClient(j)
|
||||
case objSubTypeJobMsgRefresh:
|
||||
jobMsgRefresh(j)
|
||||
case objSubTypeJobBackupExport:
|
||||
jobBackupExport(j)
|
||||
case objSubTypeJobBackupImport:
|
||||
jobBackupImport(j)
|
||||
case objSubTypeJobGStock:
|
||||
jobGStock(j)
|
||||
case objSubTypeJobGDeposit:
|
||||
jobGDeposit(j)
|
||||
default:
|
||||
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)
|
||||
if time.Now().UTC().Before(j.Timeout) {
|
||||
switch j.JobTypeID {
|
||||
case objSubTypeJobRescanMsg:
|
||||
jobRescan(j)
|
||||
case objSubTypeJobSetJobDone:
|
||||
jobSetDone(j)
|
||||
case objSubTypeJobPillage:
|
||||
jobPillage(j)
|
||||
case objSubTypeJobMsgClient:
|
||||
jobMsgClient(j)
|
||||
case objSubTypeJobMsgRefresh:
|
||||
jobMsgRefresh(j)
|
||||
case objSubTypeJobBackupExport:
|
||||
jobBackupExport(j)
|
||||
case objSubTypeJobBackupImport:
|
||||
jobBackupImport(j)
|
||||
case objSubTypeJobGStock:
|
||||
jobGStock(j)
|
||||
case objSubTypeJobGDeposit:
|
||||
jobGDeposit(j)
|
||||
default:
|
||||
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)
|
||||
}
|
||||
} else {
|
||||
log.Printf("JobWorker[%d] : Job %d timed out.\n", id, j.ID64)
|
||||
setJobDone(j.ID64)
|
||||
}
|
||||
}
|
||||
log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Closing.")
|
||||
|
Loading…
Reference in New Issue
Block a user