From 70d026c2e1697271c71241c8a5f16feff341b36d Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 11 May 2019 16:52:31 +0800 Subject: [PATCH] revert mistakeremove loop --- td.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/td.go b/td.go index 7515178..9e86f67 100644 --- a/td.go +++ b/td.go @@ -73,7 +73,6 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { var msgCount int32 = 0 var msgParsed int32 = 0 var lastParsedID64 int64 = int64(math.MaxInt64) - var loopCount int32 = 1 var lastParsedTime time.Time = time.Now() var chat int64 var m ChatWarsMessage @@ -96,15 +95,13 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { fmt.Printf("Exporting historic messages for chat %d (%s) ...\n", chat, chatDetails.Title) } - for lastParsedID64 >= 0 && loopCount > 0 { + for lastParsedID64 >= 0 { msgs, err := c.GetChatHistory(chat, lastParsedID64, 0, 33, false) - loopCount = 0 if err != nil { if err.Error() == "timeout" { logOnError(err, "Waiting...") fmt.Printf("Timeout : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64) time.Sleep(5 * time.Second) - loopCount = 1 } else { logOnError(err, "Cannot get history") lastParsedID64 = -1 @@ -152,7 +149,6 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { if m.ID64 < lastParsedID64 { lastParsedID64 = msg.ID lastParsedTime = m.Date - loopCount = loopCount + 1 } if msgParsed%1000 == 0 { fmt.Printf("Waiting : %d messages retrieved out of %d dating back %s (%d) ...\n", msgCount, msgParsed, lastParsedTime.Format(time.RFC3339), lastParsedID64)