lukecwik commented on code in PR #23046: URL: https://github.com/apache/beam/pull/23046#discussion_r966412972
########## sdks/python/apache_beam/runners/worker/statecache.py: ########## @@ -87,18 +88,46 @@ def get_referents_for_cache(*objs): return rval +class _LoadingValue(WeightedValue): + """Allows concurrent users of the cache to wait for a value to be loaded.""" + def __init__(self): + # type: () -> None + super().__init__(None, 1) + self._wait_event = threading.Event() + + def load(self, key, loading_fn): + # type: (Any, Callable[[Any], Any]) -> None + try: + self._value = loading_fn(key) + except Exception as err: Review Comment: Your right, we catch all and anyone who was blocked will get it during the call to `value` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
