-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Automatic event tracking #1776
Automatic event tracking #1776
Conversation
* SubscriberId SystemParam added to handle initializing the id correctly when system state is initialized, instead of on first use of an EventReader * Changed to use a command to update the subscriber last read counts to avoid write access to EventSubscriptions
We still want to add the |
Some ideas from discord:
(EventReader::defer_event?) edit: Not sure change detection would be very clean, and the indirection it'd probably require would be slightly less performant |
Two drawbacks/questions that seem worth discussing/noting:
|
The current setup with the RwLock will cause a decrease in performance. It also currently uses a write lock with each EventReader usage. I think both of those issues can be fixed, though. For infrequent reads, it'd empty the events less often. It'd be relatively easy to fix, though (eg the user could just split up the events by how often theyre used.) We could add a debug assert / warning for events that have been held onto for more than x frames, if it's something we're worried about. |
* Each ManualEventReader tracks its subscription through the use of a string id * These will lock resources the same way that EventReaders do * If a ManualEventReader is made after events have been read by other readers, they will not see those events.
* EventReader can now just use ManualEventReader for its own implementation
This is compelling, but deserves a cohesive design review. Once #1662 is concluded, we should open an RFC for more reliable events. |
closing this PR for now as it has drifted, please reopen once the RFC is getting ready |
An implementation of the Automatic Event Tracking RFC
Works, but if Commands are fixed to work correctly when embedded in a SystemParam, it would probably be better to remove the RwLocks in favor of using that. (Should be an easy change.)