mirror of https://github.com/jlelse/GoBlog
Fix time comparing
This commit is contained in:
parent
2e9b0ef4df
commit
954c3be6c3
|
@ -50,7 +50,7 @@ func startAPSendQueue() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if r, ok := rInterface.(*apRequest); ok {
|
if r, ok := rInterface.(*apRequest); ok {
|
||||||
if r.LastTry != 0 && time.Now().Unix()+r.LastTry < int64(r.Try*5*60) {
|
if r.LastTry != 0 && time.Now().Before(time.Unix(r.LastTry, 0).Add(time.Duration(r.Try)*5*time.Minute)) {
|
||||||
apQueue.Enqueue(r)
|
apQueue.Enqueue(r)
|
||||||
} else {
|
} else {
|
||||||
// Send request
|
// Send request
|
||||||
|
@ -60,7 +60,8 @@ func startAPSendQueue() {
|
||||||
r.LastTry = time.Now().Unix()
|
r.LastTry = time.Now().Unix()
|
||||||
apQueue.Enqueue(r)
|
apQueue.Enqueue(r)
|
||||||
} else {
|
} else {
|
||||||
log.Println("Failed for the 3rd time:", err.Error())
|
log.Printf("Request to %s failed for the 3rd time", r.To)
|
||||||
|
log.Println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue