-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmut sync.Mutex | |
cInitMut sync.Mutex |
stk.Tests = tests | ||
stk.cmut.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stk.cmut.Unlock() | |
stk.cInitMut.Unlock() |
stk.TestsSSL = ssls | ||
stk.cmut.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stk.cmut.Unlock() | |
stk.cInitMut.Unlock() |
No description provided.