If a service receives a request (eg. call.userService.user.42.set) which triggers an event (eg. event.userService.user.42.change) before sending the call response, the call response might arrive to the client prior to the event, even if they were sent from the service in the opposite order.
Cause
The issue is caused by call responses being passed directly from the message system (mq) goroutine to the connection (wsConn) queue, while all get-responses and events are passed from the mq goroutine to the eventSubscription's queue before being passed to the connection (wsConn) queue.
Solution
Call responses should be passed to the eventSubscription's queue to ensure all calls and events are handled by the same go routine. The eventSubscritpion worker will then directly passes on to the response to the connection (wsConn) queue.
Issue
If a service receives a request (eg.
call.userService.user.42.set
) which triggers an event (eg.event.userService.user.42.change
) before sending the call response, the call response might arrive to the client prior to the event, even if they were sent from the service in the opposite order.Cause
The issue is caused by call responses being passed directly from the message system (mq) goroutine to the connection (wsConn) queue, while all get-responses and events are passed from the mq goroutine to the eventSubscription's queue before being passed to the connection (wsConn) queue.
Solution
Call responses should be passed to the eventSubscription's queue to ensure all calls and events are handled by the same go routine. The eventSubscritpion worker will then directly passes on to the response to the connection (wsConn) queue.