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

Sending multiple requests in quick succession sends to same number #6

Closed
prestonvanloon opened this issue Oct 23, 2019 · 2 comments · Fixed by #7
Closed

Sending multiple requests in quick succession sends to same number #6

prestonvanloon opened this issue Oct 23, 2019 · 2 comments · Fixed by #7

Comments

@prestonvanloon
Copy link
Contributor

If you send multiple requests quickly, they overwrite the options with the receiver.

Expected: Send three requests to send message with a receiver field different phone numbers. Messages are sent to three different numbers.

Observed behavior: the message is sent three times to same number.

Here is the offending code where the request shares / reuses the same options by copying the pointer to the options.

sendOptions := m.Options

The service needs a mutex around this option or make a deep copy of the options before mutating it.

@prestonvanloon
Copy link
Contributor Author

Here's the simplest way to understand the problem: https://play.golang.org/p/rZyz-ivCnch

@prestonvanloon
Copy link
Contributor Author

And here's a simple fix to that example: https://play.golang.org/p/_NLLKtaP0mv

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 a pull request may close this issue.

1 participant