test
This commit is contained in:
parent
1498097962
commit
23f4120d71
10
td.go
10
td.go
@ -72,6 +72,7 @@ func ListenCW(c *tdlib.Client) {
|
|||||||
func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
||||||
var msgCount int32 = 0
|
var msgCount int32 = 0
|
||||||
var msgParsed int32 = 0
|
var msgParsed int32 = 0
|
||||||
|
var loopOverflow int32 = 0
|
||||||
var lastParsedID64 int64 = int64(math.MaxInt64)
|
var lastParsedID64 int64 = int64(math.MaxInt64)
|
||||||
var lastParsedTime time.Time = time.Now()
|
var lastParsedTime time.Time = time.Now()
|
||||||
var chat int64
|
var chat int64
|
||||||
@ -160,8 +161,13 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
|
|||||||
lastParsedID64 = -1
|
lastParsedID64 = -1
|
||||||
}
|
}
|
||||||
if prevLastParsedID64 == lastParsedID64 {
|
if prevLastParsedID64 == lastParsedID64 {
|
||||||
// we should be at the end !
|
loopOverflow++
|
||||||
lastParsedID64 = -1
|
if loopOverflow == 5 {
|
||||||
|
// we should be at the end !
|
||||||
|
lastParsedID64 = -1
|
||||||
|
} else {
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("Exported %d messages.\n", msgCount)
|
log.Printf("Exported %d messages.\n", msgCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user