Skip to content

Commit

Permalink
fix: Manage redis pipe's context (feast-dev#3655)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiwon Park <bakjeeone@hotmail.com>
  • Loading branch information
phil-park authored Jul 4, 2023
1 parent 4861af0 commit 48e0971
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sdk/python/feast/infra/online_stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")

Expand Down

0 comments on commit 48e0971

Please sign in to comment.