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

Fix race in tests #1

Closed
sharonjl opened this issue Dec 20, 2018 · 2 comments
Closed

Fix race in tests #1

sharonjl opened this issue Dec 20, 2018 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@sharonjl
Copy link
Owner

Run tests with the -race flag:

go test -v -race ./...
@sharonjl sharonjl added the help wanted Extra attention is needed label Dec 20, 2018
@u5surf
Copy link
Contributor

u5surf commented Dec 20, 2018

@sharonjl
Hi, I fixed these tests race conditions using sync.Mutex lock for consumeCount.
On the other hand, I think it is better to use channel lock than using Mutex following golang philosophy.
https://blog.golang.org/share-memory-by-communicating
which should I use channel or Mutex?
c.f. https://github.com/golang/go/wiki/MutexOrChannel

@sharonjl
Copy link
Owner Author

sharonjl commented Dec 21, 2018

Oh awesome, honestly channels might be a bit overkill. These are just tests, as long as they work properly and test the functional aspect of the library, either is fine. I'll leave it up to you!

u5surf added a commit to u5surf/sqsx that referenced this issue Dec 21, 2018
u5surf added a commit to u5surf/sqsx that referenced this issue Dec 22, 2018
u5surf added a commit to u5surf/sqsx that referenced this issue Dec 22, 2018
@u5surf u5surf mentioned this issue Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants