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

refactor: signal handling to improve clarity and correctness #1980

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EinoPlasma
Copy link

Renaming: The constant interruptSignalsCount has been renamed to maxInterruptSignals to better reflect its purpose, which is to define the maximum number of interrupt signals that can be handled.

Loop Fix: The loop condition has been corrected to iterate from 0 to maxInterruptSignals, ensuring that the loop runs the expected number of times.

- Renamed interruptSignalsCount to maxInterruptSignals for better readability.
- Fixed the loop condition to correctly iterate from 0 to maxInterruptSignals.
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)

go func() {
for i := range interruptSignalsCount {
for i := 0; i < maxInterruptSignals; i++ {
Copy link
Member

Choose a reason for hiding this comment

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

These loops are functionally the same and I personally prefer the newer for i := range maxInterruptSignals syntax.

No objection to the renaming.

Copy link
Member

Choose a reason for hiding this comment

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

I agree

@vmaerten vmaerten changed the title Refactor signal handling to improve clarity and correctness refactor: signal handling to improve clarity and correctness Dec 31, 2024
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.

3 participants