Slow down the spinner a bit#419
Merged
marc-vanderwal merged 1 commit intozonemaster:developfrom May 27, 2025
Merged
Conversation
tgreenx
previously approved these changes
Jan 29, 2025
mattias-p
previously approved these changes
Feb 10, 2025
The console output of zonemaster-cli includes an optional spinner, looping over four frames, with each frame being advanced whenever Zonemaster::Engine outputs a message, even if it isn’t shown. However, over the course of a single domain test, Zonemaster::Engine outputs thousands of messages of level DEBUG1 or lower. As a result, the spinner’s animation is far too fast to be enjoyable and a lot of strain is put on the user’s terminal. This change simply ensures that no frame is shown for less than 0.1 seconds. The animation looks smoother and doesn’t run the risk overloading the terminal.
a19cfdb to
5a6c402
Compare
Contributor
Author
|
Rebased on latest @tgreenx and @mattias-p, can I have another review, please? |
mattias-p
approved these changes
May 27, 2025
tgreenx
approved these changes
May 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR slows down the spinner in zonemaster-cli to improve the animation’s appearance on the terminal and to avoid overloading the terminal’s standard output with thousands of calls.
In a nutshell, the code no longer advances the animation if the current frame has been showing for less than 0,1 seconds.
Context
Searching for performance improvements to be made in
zonemaster-cli.Changes
Slow down the spinner.
How to test this PR
Run
zonemaster-cli zonemaster.net. The spinner’s animation should be slower, and actually look like it’s spinning. The animation may still pause briefly a few times, like before: that’s because Zonemaster-Engine sometimes does not emit any message for a few seconds while it is waiting for a response from remote name servers.