Feature request: Avoid synchronous read on subscribe_event()
As part of the Taurus Performance Optimization project, we significantly improved the Taurus GUI startup time by avoiding reads during startup and retrieving values in batch after the application has launched. However, attributes with events do not benefit from this improvement. That's because the subscribe_event() method in the Tango DeviceProxy causes a synchronous read that can slow down the application startup by up to 3 seconds per attribute if the attribute raises a timeout.
To address this and achieve the same fast startup for attributes with events, we proposed two possible changes in Tango. We wanted to open a discussion to see which one is the best approach to solve this issue:
Optional read in the subscribe_event() method
Add a new argument to the subscribe_event() method, (e.g read_attr). When set to False, subscribe_event() will skip the read of the value and will return immediately with the event ID (or raise an exception if the attribute doesn’t send events as usual). Unlike the current behavior, it won’t trigger a push_event callback since no read is performed. In this scenario, it becomes the caller’s responsibility to retrieve the attribute value through other methods.
@nleclercq already created an issue for this approach in #1184 (closed).
Asynchronous read in the subscribe_event() method
Add a new argument to the subscribe_event() method (e.g. read_asynch). When set to True, this method would return immediately with the event ID but perform the actual read asynchronously. Once the value is asynchronously retrieved, it would trigger the push_event callback as usual.
Both options could be implemented. With a single argument we could choose between the options. For example, an option called "read_attr" with values "Synch", "Asynch" or "NoRead". By default, this argument will be set to "Synch", preserving the current behavior (it can be discussed if it's better to set "Asynch" as the new default behavior).
If you want information on how this would be used by Taurus, you could check this Taurus issue.