From 954c3be6c340296e62470c7f78ef0f255af618e8 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sun, 22 Nov 2020 18:29:46 +0100 Subject: [PATCH] Fix time comparing --- activityPubSending.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/activityPubSending.go b/activityPubSending.go index 0786047..a509164 100644 --- a/activityPubSending.go +++ b/activityPubSending.go @@ -50,7 +50,7 @@ func startAPSendQueue() { continue } 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) } else { // Send request @@ -60,7 +60,8 @@ func startAPSendQueue() { r.LastTry = time.Now().Unix() apQueue.Enqueue(r) } else { - log.Println("Failed for the 3rd time:", err.Error()) + log.Printf("Request to %s failed for the 3rd time", r.To) + log.Println() } } }