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

Reduce missed Frequency updates, reduce mutex locks, update docs #43

Merged
merged 1 commit into from
Dec 11, 2021

Conversation

theckman
Copy link
Owner

This change is a small update to help make the spinner a bit more robust.

The first increases internal channel buffer size for frequency updates, to hopefully
non-blocking write dropping an update. The buffer size increase is arbitrary,
and calling .Frequency() in a hot loop could still result in dropped updates.

The second is the removal of a mutex lock within the Status() method, and an
unnecessary nil check. There is not a need for either of them based on how
the *Spinner is constructed.

The third is some refinemennt of the documentation both in comments on exported
identifiers, and comments within the source code.

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #43 (8153131) into master (fb3269b) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
- Coverage   94.43%   94.42%   -0.02%     
==========================================
  Files           2        2              
  Lines         521      520       -1     
==========================================
- Hits          492      491       -1     
  Misses         15       15              
  Partials       14       14              
Flag Coverage Δ
unittests 94.42% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
spinner.go 94.24% <100.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb3269b...8153131. Read the comment docs.

@theckman theckman force-pushed the better_frequency_handling branch 4 times, most recently from 33d2c23 to b3f7765 Compare December 11, 2021 21:16
This change is a small update to help make the spinner a bit more robust.

The first increases internal channel buffer size for frequency updates, to hopefully
non-blocking write dropping an update. The buffer size increase is arbitrary,
and calling .Frequency() in a hot loop could still result in dropped updates.

The second is the removal of a mutex lock within the Status() method, and an
unnecessary nil check. There is not a need for either of them based on how
the *Spinner is constructed.

The third is some refinemennt of the documentation both in comments on exported
identifiers, and comments within the source code.
@theckman theckman force-pushed the better_frequency_handling branch from b3f7765 to 8153131 Compare December 11, 2021 21:19
@theckman
Copy link
Owner Author

@codecov can't do math. This build is fine.

@theckman theckman merged commit a615053 into master Dec 11, 2021
@theckman theckman deleted the better_frequency_handling branch December 11, 2021 21:21
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

Successfully merging this pull request may close these issues.

1 participant