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

Production()/Development() is not thread-safe (and more generally ClientManager will have inconsistent results if switching between Development/Production) #95

Closed
froodian opened this issue Oct 11, 2017 · 1 comment

Comments

@froodian
Copy link

  1. go version go1.8.3
  2. darwin/amd64
  3. Called client.Production() / client.Development() on clients return from ClientManager.Get
  4. Expected no data race
  5. Had "data race detected" from a test, between the line in my code calling client.Production() and apns2/client.go:156 (url := fmt.Sprintf("%v/3/device/%v", c.Host, n.DeviceToken))
@froodian froodian changed the title Production/Development is not thread-safe (and more generally ClientManager will have inconsistent results if switching between Development/Production) Production()/Development() is not thread-safe (and more generally ClientManager will have inconsistent results if switching between Development/Production) Oct 11, 2017
@froodian
Copy link
Author

I solved this by just keeping a ClientManager full of production clients and a ClientManager full of development clients, I feel like that's a fine solution and removes the ambiguity if another thread is sending on the client when you try to switch gateways, so I feel like that's a good answer to this, closing. Sorry about the noise.

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

No branches or pull requests

1 participant