mirror of
https://github.com/iyear/tdl
synced 2025-01-08 11:57:55 +08:00
chore(forward): pass part size in options
This commit is contained in:
parent
d6159dfbb6
commit
d8789f7c74
@ -86,6 +86,7 @@ func Run(ctx context.Context, opts Options) error {
|
||||
DryRun: opts.DryRun,
|
||||
Mode: opts.Mode,
|
||||
Progress: newProgress(fwProgress),
|
||||
PartSize: viper.GetInt(consts.FlagPartSize),
|
||||
})
|
||||
|
||||
go fwProgress.Render()
|
||||
|
@ -67,8 +67,7 @@ func (f *Forwarder) CloneMedia(ctx context.Context, opts CloneOptions) (tg.Input
|
||||
return nil
|
||||
})
|
||||
|
||||
err := wg.Wait()
|
||||
if err != nil {
|
||||
if err := wg.Wait(); err != nil {
|
||||
return nil, errors.Wrap(err, "wait")
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,8 @@ import (
|
||||
"github.com/gotd/td/telegram/message"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/tmedia"
|
||||
@ -41,6 +39,7 @@ type Elem struct {
|
||||
|
||||
type Options struct {
|
||||
Pool dcpool.Pool
|
||||
PartSize int
|
||||
Iter Iter
|
||||
Silent bool
|
||||
DryRun bool
|
||||
@ -178,7 +177,7 @@ func (f *Forwarder) forwardMessage(ctx context.Context, from, to peers.Peer, msg
|
||||
|
||||
mediaFile, err := f.CloneMedia(ctx, CloneOptions{
|
||||
Media: media,
|
||||
PartSize: viper.GetInt(consts.FlagPartSize),
|
||||
PartSize: f.opts.PartSize,
|
||||
Progress: uploadProgress{
|
||||
meta: meta,
|
||||
progress: f.opts.Progress,
|
||||
@ -211,7 +210,7 @@ func (f *Forwarder) forwardMessage(ctx context.Context, from, to peers.Peer, msg
|
||||
|
||||
thumbFile, err := f.CloneMedia(ctx, CloneOptions{
|
||||
Media: thumb,
|
||||
PartSize: viper.GetInt(consts.FlagPartSize),
|
||||
PartSize: f.opts.PartSize,
|
||||
Progress: nopProgress{},
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user