mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-17 07:25:46 +03:00
gotd/tgerr: reduce default flood wait max duration
This commit is contained in:
@@ -102,9 +102,11 @@ func (tc *TelegramClient) syncChats(ctx context.Context, takeoutID int64, onLogi
|
||||
dialogs, err := APICallWithUpdates(ctx, tc, func() (tg.ModifiedMessagesDialogs, error) {
|
||||
var dialogs tg.MessagesDialogsBox
|
||||
retry := true
|
||||
attempts := 0
|
||||
var err error
|
||||
for retry {
|
||||
for retry && attempts < 5 {
|
||||
retry, err = tgerr.FloodWait(ctx, tc.client.Invoke(ctx, wrappedReq, &dialogs))
|
||||
attempts++
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -66,7 +66,7 @@ func FloodWaitWithMaxDuration(d time.Duration) FloodWaitOption {
|
||||
func FloodWait(ctx context.Context, err error, opts ...FloodWaitOption) (bool, error) {
|
||||
opt := &floodWaitOptions{
|
||||
clock: clock.System,
|
||||
maxDuration: 1 * time.Hour,
|
||||
maxDuration: 5 * time.Minute,
|
||||
}
|
||||
for _, o := range opts {
|
||||
o.apply(opt)
|
||||
|
||||
Reference in New Issue
Block a user