damccorm commented on code in PR #41396:
URL: https://github.com/apache/beam/pull/41396#discussion_r4687119204


##########
sdks/python/apache_beam/runners/worker/sdk_worker.py:
##########
@@ -1268,11 +1268,9 @@ def extend(
 
         # Materialize provided iterable to ensure reproducible iterations,
         # here and when writing to the state handler below.
-        elements = list(elements)
-        cached_value.extend(elements)
-        # Re-insert into the cache the updated value so the updated size is
-        # reflected.
-        self._state_cache.put((cache_key, cache_token), cached_value)
+        materialized = list(elements)
+        elements = materialized
+        self._state_cache.extend((cache_key, cache_token), materialized)

Review Comment:
   ```suggestion
           elements = list(elements)
           self._state_cache.extend((cache_key, cache_token), elements)
   ```
   
   Isn't this equivalent/simpler?



-- 
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]

Reply via email to