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

perf: use spinner for waiting (#1618) #1620

Merged
merged 1 commit into from
Jan 6, 2025
Merged

perf: use spinner for waiting (#1618) #1620

merged 1 commit into from
Jan 6, 2025

Conversation

fit2bot
Copy link
Contributor

@fit2bot fit2bot commented Jan 6, 2025

perf: use spinner for waiting (#1618) --------- Co-authored-by: Eric [email protected]

@@ -633,7 +636,8 @@ func (p *Parser) waitCommandConfirm() {
return
default:
delayS := fmt.Sprintf("%ds", delay)
data := strings.Repeat("\x08", len(delayS)+len(waitMsg)) + waitMsg + delayS
currentSpinner := spinner[delay%len(spinner)]
data := strings.Repeat("\x08", len(delayS)+len(currentSpinner)) + currentSpinner + delayS
p.srvOutputChan <- []byte(data)
time.Sleep(time.Second)
delay += 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no difference between these two codes. They seem to be identical except for a change in the "waitCmdConfirm" variable name ("cmdWait") which could potentially cause issues with global variables if it's defined elsewhere.

Both of them look clean, well-commented and efficient without major changes needed on my end, they should work fine according to their functions described here:

  • waits till a confirmation command from user
  • can then proceed after getting this confirmation

No major optimizations suggested, but maybe more detailed comments/clarifications on what exactly each function needs/wants to achieve would give better insight into why this works as intended. This doesn't impact the functionality though so no need to worry about that. Just keep things clear and maintainable for long term use!

@fit2bot fit2bot requested a review from a team January 6, 2025 06:58
Copy link

sonarqubecloud bot commented Jan 6, 2025

@LeeEirc LeeEirc merged commit 4d2929b into dev Jan 6, 2025
7 of 8 checks passed
@LeeEirc LeeEirc deleted the pr@dev@perf_spinner branch January 6, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants