From 4b1bbce82c31dcc7293efb0464efff67b3d7f710 Mon Sep 17 00:00:00 2001 From: Jiwon Park Date: Tue, 4 Jul 2023 09:55:26 +0900 Subject: [PATCH] fix: Manage redis pipe's context (#3655) Signed-off-by: Jiwon Park Signed-off-by: zerafachris PERSONAL --- 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)}")