-
Notifications
You must be signed in to change notification settings - Fork 560
fix: subscribing to a message channel while unsubscribing is pending [MTT-3756] #675
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed it in Slack, implementation looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add tests for this case, so there's no regression in the future. This way, even though we don't have a use case in game, we'd have tests to make sure this behaviour doesn't change later.
Instead of auto-injecting in everything inside UICanvas, only include GameObjects that don't already have their components registered via ClientMainMenuState to avoid injecting twice into the same MonoBehaviour
…OnNetworkSpawn/Despawn
* develop: fix: subscribing to a message channel while unsubscribing is pending [MTT-3756] (#675) # Conflicts: # Assets/Scripts/Gameplay/GameState/ServerBossRoomState.cs
Description
This PR makes sure that when subscribing to a message channel after having previously subscribed and unsubscribed to it works properly, even if no messages have been published in the mean time. To do so, we keep the list of pending additions and removals from the list of handlers in a dictionary. If we subscribe while a pending unsubscribe is in the dictionary, we simply remove it from the dictionary instead of adding a new pending subscription, and we do the same when unsubscribing if we have a pending subscription.
Issue Number(s)
MTT-3756
Contribution checklist