theckman / yacspin

Yet Another CLi Spinner; providing over 80 easy to use and customizable terminal spinners for multiple OSes
Apache License 2.0
434 stars 13 forks source link

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

Closed theckman closed 2 years ago

theckman commented 2 years ago

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[bot] commented 2 years ago

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%) :arrow_down:

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%) :arrow_down:

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 commented 2 years ago

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