Consider allowing to add/remove receivers from Select
dynamically
#24
Replies: 3 comments
-
This will probably be closed in favor of #29, as we don't want to add new ways to misuse |
Beta Was this translation helpful? Give feedback.
-
We will not pursue this feature and improve documentation (#29) to make it clear that |
Beta Was this translation helpful? Give feedback.
-
The current proposal is to implement this externally, by adding support to add/remove channels to a |
Beta Was this translation helpful? Give feedback.
-
We have some use cases where we need to add/remove receivers to a
Select
inside the.ready()
loop. For now we need to create a second loop whereSelect
is created, thenbreak
the inside (.ready()
) loop and re-generate theSelect
object, which is inconvenient from the POV of the code, and also makes the code harder to read, as the flow becomes more complicated.Another big issue with this approach is if it's not done very carefully, we can lose messages from receivers if the
break
is done before all available messages from all receivers in the current loop are not handled. Thebreak
should always be the last in the loop.This also applies to
Merge
andMergeNamed
.Example:
https://github.com/frequenz-floss/frequenz-sdk-python/blob/4ce090ce32f539014101f145e8f97fc67990fa9e/src/frequenz/sdk/data_ingestion/microgrid_data.py#L229-L260
Other use case came from here:
Beta Was this translation helpful? Give feedback.
All reactions