Adding internal timeout to job pillage
This commit is contained in:
parent
90853271d3
commit
d018453106
3
def.go
3
def.go
@ -214,7 +214,8 @@ type JobPayloadMsgRefresh struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JobPayloadPillage struct {
|
type JobPayloadPillage struct {
|
||||||
ObjID64 int64 `json:"obj_id"`
|
ObjID64 int64 `json:"obj_id"`
|
||||||
|
Date time.Time `json:"date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobPayloadTribute struct {
|
type JobPayloadTribute struct {
|
||||||
|
11
job.go
11
job.go
@ -351,6 +351,17 @@ func jobPillage(j Job) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is the job outdated now ?
|
||||||
|
if r.Date.Before(time.Now().Sub(3*time.Minute + 30*time.Second)) {
|
||||||
|
s := TGCommand{
|
||||||
|
Type: commandSendMsg,
|
||||||
|
Text: fmt.Sprintf("Pillage interception expired"),
|
||||||
|
ToUserID64: j.UserID64,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- s
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
s := TGCommand{
|
s := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
Text: fmt.Sprintf("No outcome for the pillage yet"),
|
Text: fmt.Sprintf("No outcome for the pillage yet"),
|
||||||
|
Loading…
Reference in New Issue
Block a user