Skip to content

Commit

Permalink
minor: rename totalEwmaIncr to totalBarIncr
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Apr 11, 2024
1 parent 6cac6b8 commit edec169
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions getparty.go
Expand Up @@ -252,7 +252,7 @@ func (cmd *Cmd) Run(args []string, version, commit string) (err error) {
mpb.WithRefreshRate(refreshRate*time.Millisecond),
mpb.WithWidth(64),
)
totalEwmaIncr, totalCancel, err := session.makeTotalBar(ctx,
totalBarIncr, totalCancel, err := session.makeTotalBar(ctx,
progress,
&doneCount,
cmd.options.Quiet,
Expand Down Expand Up @@ -281,7 +281,7 @@ func (cmd *Cmd) Run(args []string, version, commit string) (err error) {
p.maxTry = cmd.options.MaxRetry
p.single = len(session.Parts) == 1
p.progress = progress
p.totalEwmaIncr = totalEwmaIncr
p.totalBarIncr = totalBarIncr
p.dlogger = log.New(cmd.getErr(), fmt.Sprintf("[%s:R%%02d] ", p.name), log.LstdFlags)
req, err := http.NewRequest(http.MethodGet, session.location, nil)
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions part.go
Expand Up @@ -32,14 +32,14 @@ type Part struct {
Skip bool
Elapsed time.Duration

ctx context.Context
name string
order int
maxTry uint
single bool
progress *mpb.Progress
dlogger *log.Logger
totalEwmaIncr func(int, time.Duration)
ctx context.Context
name string
order int
maxTry uint
single bool
progress *mpb.Progress
dlogger *log.Logger
totalBarIncr func(int, time.Duration)
}

type flashBar struct {
Expand Down Expand Up @@ -326,7 +326,7 @@ func (p *Part) download(client *http.Client, req *http.Request, timeout, sleep t
if p.total() <= 0 {
bar.SetTotal(p.Written, false)
} else {
p.totalEwmaIncr(n, dur)
p.totalBarIncr(n, dur)
}
bar.EwmaIncrBy(n, dur)
<-sleepCtx.Done()
Expand Down

0 comments on commit edec169

Please sign in to comment.