I implemented the lazy pirate pattern for my client module, which works great for retrying the requests. But here's the problem.
- REQ Client sends message to REP server. [OK]
- REP server interprets the message. [OK]
- REP server executes some action, and prepares the response. [OK]
- REP server sends back the response. [OK]
- REQ Clients polls message but doesn't receive any until it timeout. [NOT OK]
- REQ Client restarts the socket, and retries to send the request again. [NOT OK]
- REP Server executes the action again. [THE PROBLEM]
- This time REQ Client successfully receives the response. [OK]
That's the problem, I'm executing the action twice which was intended to be only executed once. I think this is the best way I could explain it.
In certain occasions client can send simultaneously send request to server as I have a coroutine running on a thread, separated from the main thread both of which has functionality that sends request to server. Could this be the cause of it?
I also have multiple of these clients connected to the server, could this be the problem?
Thank you!