Open artem-webdev opened 4 years ago
Actually this line of code avoids deadlocks. You can read more about channel selects here https://tour.golang.org/concurrency/, but basically the first channel to be ready executes the case block, the other(s) case block(s) is/are ignored. Unfortunately that doesn't mean the "send message" request was cancelled, meaning that even when the timeout is reached, the app can still send a message after some time. When a timeout happens, the safest bet would be verify manually if the message has been sent. History checking and local cache would help
Thanks for the answer, but the question was not about the timer, the question is why this is not a warning but an error, and in fact there is no point in processing it, it’s more sense if you ignore it. Messages are still delivered! In general, there is more than one such place in the code, I just don’t understand whether this can be fixed or is it a delay from whatsapp api?
for example here https://github.com/Rhymen/go-whatsapp/blob/1a11f6d7ef42d3cc182985285b2ae9a0e7b3f71a/contact.go#L58 or here https://github.com/Rhymen/go-whatsapp/blob/1a11f6d7ef42d3cc182985285b2ae9a0e7b3f71a/contact.go#L89
perhaps you can still find problem areas where returns <-chan
hi everyone, can anyone explain how to handle this correctly
It's just the send timeout. If no response was read during wac.msgTimeout
, the operation is timed out and the for loop broken.
perhaps you can still find problem areas where returns <-chan
@artem-webdev what problem is exactly are you trying to solve here? Return channels in go is not a "problem area"?
In general, there is more than one such place in the code, I just don’t understand whether this can be fixed or is it a delay from whatsapp api?
The logic is simple: if you send a message, you should receive an answer. If not something went wrong.
Why you don't get an answer is another question, also discussed in https://github.com/Rhymen/go-whatsapp/issues/410.
hi everyone, can anyone explain how to handle this correctly
https://github.com/Rhymen/go-whatsapp/blob/1a11f6d7ef42d3cc182985285b2ae9a0e7b3f71a/message.go#L89
is it just a trick to get out of the select?
maybe the message sending time has not expired, but the message status response time has expired ?