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

Guard raceable properties with mutex, fixes #19 #20

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

Conversation

mrngm
Copy link

@mrngm mrngm commented Oct 29, 2019

No description provided.

Copy link
Owner

@mtulio mtulio left a comment

Choose a reason for hiding this comment

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

Hello @mrngm , thanks to contribute! 👍

Following the mutex name for TestsSSL and Tests mutex, I suggest to rename the controlInit mutex too, what do you think?

testsSSLMut sync.Mutex
TestsSSL []*statuscake.Ssl

cmut sync.Mutex
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
cmut sync.Mutex
cInitMut sync.Mutex

stk.Tests = tests
stk.cmut.Lock()
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
stk.cmut.Lock()
stk.cInitMut.Lock()

if !stk.controlInit {
log.Println(" Initial API discovery returns the Total of Tests:", len(tests))
stk.controlInit = true
}
stk.cmut.Unlock()
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
stk.cmut.Unlock()
stk.cInitMut.Unlock()

stk.TestsSSL = ssls
stk.cmut.Lock()
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
stk.cmut.Lock()
stk.cInitMut.Lock()

if !stk.controlInit {
log.Println(" Initial API discovery returns the Total of SSL Tests:", len(stk.TestsSSL))
}
stk.cmut.Unlock()
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
stk.cmut.Unlock()
stk.cInitMut.Unlock()

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.

2 participants