Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChangeMax not working #147

Open
djarbz opened this issue Nov 21, 2022 · 0 comments
Open

ChangeMax not working #147

djarbz opened this issue Nov 21, 2022 · 0 comments

Comments

@djarbz
Copy link

djarbz commented Nov 21, 2022

I start my progress bar as indeterminate for the first query that retrieves the count.
Then I set the count as the new max, my log line does show the correct number.
The progress bar never changes from indeterminate to an actual progress bar.

Here is my setup.

bar := progressbar.NewOptions(
	-1,
	progressbar.OptionSetDescription("Fetching messages from API"),
	progressbar.OptionSetWriter(os.Stderr),
	progressbar.OptionFullWidth(),
	progressbar.OptionEnableColorCodes(true),
	progressbar.OptionSetPredictTime(true),
	progressbar.OptionShowCount(),
	progressbar.OptionShowIts(),
	progressbar.OptionShowElapsedTimeOnFinish(),
	progressbar.OptionSetItsString("Msgs"),
	progressbar.OptionSpinnerType(14),
	progressbar.OptionSetRenderBlankState(true),
)

// This is just the initial query
folderMessages := f.getMessages(client, log.Named("Messages"), queryLimit)
msgCount := *folderMessages.GetOdataCount()
log.With(zap.Int64("Count", msgCount)).Info("Message Count")
bar.ChangeMax64(msgCount)

// Proceeds to the processing loop

And inside my loop.

if err := bar.Add(1); err != nil {
	log.With(zap.Error(err)).Error("Failed to increment progress bar!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant