From 9f6d64acc511eddfd6eae1a0a887e1ec6f91d60f Mon Sep 17 00:00:00 2001 From: Jiwon Park Date: Tue, 20 Jun 2023 15:28:19 +0900 Subject: [PATCH] fix: Manage redis pipe's context Signed-off-by: Jiwon Park --- sdk/python/feast/infra/online_stores/redis.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/python/feast/infra/online_stores/redis.py b/sdk/python/feast/infra/online_stores/redis.py index 8af2097076..83922068ac 100644 --- a/sdk/python/feast/infra/online_stores/redis.py +++ b/sdk/python/feast/infra/online_stores/redis.py @@ -89,15 +89,15 @@ class RedisOnlineStore(OnlineStore): def delete_entity_values(self, config: RepoConfig, join_keys: List[str]): client = self._get_client(config.online_store) deleted_count = 0 - pipeline = client.pipeline(transaction=False) prefix = _redis_key_prefix(join_keys) - for _k in client.scan_iter( - b"".join([prefix, b"*", config.project.encode("utf8")]) - ): - pipeline.delete(_k) - deleted_count += 1 - pipeline.execute() + with client.pipeline(transaction=False) as pipe: + for _k in client.scan_iter( + b"".join([prefix, b"*", config.project.encode("utf8")]) + ): + pipe.delete(_k) + deleted_count += 1 + pipe.execute() logger.debug(f"Deleted {deleted_count} rows for entity {', '.join(join_keys)}")