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

How to solve the order problem of Handle? #312

Open
meowao opened this issue Jun 27, 2023 · 0 comments
Open

How to solve the order problem of Handle? #312

meowao opened this issue Jun 27, 2023 · 0 comments

Comments

@meowao
Copy link

meowao commented Jun 27, 2023

We know that in Pitaya, processing a user's message may occur in different goroutines, which can cause some issues.
For example, if a user sells an item and obtains coins, having enough coins to purchase another new item, and then they buy the new item.
If the selling operation and the buying operation are handled in different goroutines, and the purchase operation is processed first, the purchase will fail due to insufficient coins.

To address this, we introduced AgentDispatch, which puts the processing of each user's received messages into the same goroutine (though we are not sure if this approach has any issues).
image

image

However, the problem still exists when players perform actions in the game server, and we use Pitaya.RPC to return the results to the player data server, where the RPC messages are processed in different goroutines.
Therefore, we have to add a message queue to handle this in AgentDispatch.

I don't believe this is a good solution. I would like to know how you handle the order problem with Handle, or if you don't have such an issue at all.

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