-
Notifications
You must be signed in to change notification settings - Fork 14
[OF-1736] feat: Expose AsyncCall to DuplicateSpace #844
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
[OF-1736] feat: Expose AsyncCall to DuplicateSpace #844
Conversation
🚀 Pull Request Review GuidelinesThank you for taking the time to review this Pull Request. The following is a summary of our Pull Request guidelines. The full guidelines can be found here. 💬 How to Provide FeedbackWe use a comment ladder when leaving review comments to avoid any ambiguity.
All comments should be prefixed with one of the above tags, for example: 🎯 PR Author Focus Areas
Thanks again for taking the time to review this Pull Request. |
- Update the error message logged when the 'AsyncCallCompletedCallback' is not set successfully. - Correct a typo comment in the 'AsyncCallCompletedEventData' class.
The SpaceSystem was being passed to the NetworkEventBus ctor by ptr and then we had a nullptr check to ensure it was valid before attempting to add an event listener. However, the NetworkEventBus cannot be null and should therefore be passed by ref. The MultiplayerConnection::GetEventBus() method has been updated to return a reference to the EventBus. This ref is then passed to the systems, which dereference it before passing it to the SystemBase class. This is similar to what is done with the LogSystem. I also took the opportunity to remove any 'In' prefixes from related method arguments. [OF-1736] fix: Update
- Added more detailed comments to the DuplicateSpaceAsync() method to enumerate the operation data that would be returned via the AsyncCallCompletedCallback. - Updated the comments for the OnAsyncCallCompletedEvent() method to match.
-Updated the DuplicateSpaceAsyncTest promise to capture the NetworkEventData rather than asserting equality within the lambda. - Added a 30 second timeout to the future wait to account for the async operation timing out due to backed service load. - Updated the EXPECT_* to be ASSERT_*.
10ba011 to
e6d8ab2
Compare
… dtor Previously individual systems were responsible for deregistering their system callbacks with the NetworkEventBus on destruction. However, the NetworkEventBus (which is owned by the MultiplayerConnection) is one of the last systems to be cleaned up by the SystemsManager, so it made sense to move this logic to the NetworkEventBus dtor.
Updated docs for the DuplicateSpace and DuplicateSpaceAsync methods to outline behaviour if the user disconnects while the operation is being carried out.
- Inject UserSystem into the SpaceSystem via it's ctor so that it can be used without having to rely on the singleton. - Adopt the Convert utility for creating a vector of MemberGroupIds from the provided Optional Array.
Updated the SystemsManager::GetEventBus() method to return a ptr to the EventBus. I had updated it to return a ref forgetting that the wrapper generator does not support that.
The current DuplicateSpace method is a synchronous operation that can timeout and fail if the Space is overly complex or the backend services are under excessive load.
A new generic
AsyncCallCompletedevent has been added by the backend services to alert the user when a specific async operation has completed. Operations such as DuplicateSpace can take a AsyncCall bool argument, which determines whether the operation should be performed synchronously or asynchronously.If performed asynchronously the call will immediately return a result object, which in the case of Duplicate Space will contain a 204 - No content response on success. Then, once the actual duplication operation has been completed, the
AsyncCallCompletedevent will fire, passing aAsyncCallCompletedEventDataobject.As part of this work the current
DuplicateSpacemethod has been marked deprecated and a newDuplicateSpaceAsyncmethod has been introduced. This approach has been taken for two reasons:A new
AsyncCallCompletedCallbackHandlerhas been introduced along with a public setter to allow clients to register for theAsyncCallCompletedevent:SetAsyncCallCompletedCallback().As noted above, this event will return a generic 'AsyncCallCompletedEventData` object, which in the case of the duplicate Space operation, will contain the following data: