Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cmd/tg/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type app struct {

cfg Config
log *zap.Logger
waiter *floodwait.Waiter
waiter *floodwait.SimpleWaiter
printer *output.Printer

// active is the account currently being operated on (set per run iteration).
Expand All @@ -80,7 +80,7 @@ func newApp() *app {
}

return &app{
waiter: floodwait.NewWaiter(),
waiter: floodwait.NewSimpleWaiter(),
log: defaultLog,
printer: output.New(output.Text, nil),
}
Expand Down Expand Up @@ -225,10 +225,8 @@ func (a *app) connectWith(
}
client := telegram.NewClient(appID, appHash, a.optionsFor(st, rp, d))

if err := a.waiter.Run(ctx, func(ctx context.Context) error {
return client.Run(ctx, func(ctx context.Context) error {
return f(ctx, client, d)
})
if err := client.Run(ctx, func(ctx context.Context) error {
return f(ctx, client, d)
}); err != nil && !errors.Is(err, context.Canceled) {
return err
}
Expand Down