-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Simplify the implementation of the message buffering #2123
base: master
Are you sure you want to change the base?
Conversation
Found Clippy warningsClippy Warnings/Errors
|
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.
This looks good, I tested it with offset transforms and everything still works.
In general I'm still a bit uncertain if the message buffering is the correct solution to "async" messages that can only be run once a "promise" is resolved. There essentially needs to be a way for the message to be queued and executed once some data is available after some number of renders. Currently this is necessary for layers to await until their transform has been computed and returned, but in the future a more flexible system might be necessary where for instance a message can be queued for a certain number of milliseconds or until some state changes in the network, which may take multiple renders
if let Some(buffered_queue) = self.buffered_queue.take() { | ||
self.message_queues.extend(buffered_queue); | ||
self.message_queues = buffered_queue; |
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.
Is there a reason why the buffered queue replaces the current message queues? I think it could be possible for there to still be messages in self.message_queues, which would be lost here.
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.
The current message queues will always be empty (except for the end buffer event), since they are cleared by the start buffer event and all other messages are added directly to the buffer.
This is an attempt to slightly simplify the logic of the message buffering, whilst also fixing the debug message tree during buffering such that the message parents are properly aligned.
Also improved was the functionality when attempting to run another message when a buffer is open. Instead of this new message being processed first, it is processed last.