Skip to content

Batching key delete using scan - #45

Merged
YaphetKG merged 2 commits into
developfrom
patch/batch-iter-redis-keys
Nov 2, 2021
Merged

Batching key delete using scan#45
YaphetKG merged 2 commits into
developfrom
patch/batch-iter-redis-keys

Conversation

@YaphetKG

@YaphetKG YaphetKG commented Nov 2, 2021

Copy link
Copy Markdown

No description provided.

@YaphetKG YaphetKG changed the title Batching key delete for using scan Batching key delete using scan Nov 2, 2021
Comment thread dags/roger/core.py Outdated

def batch_keys(self, batch_size):
from itertools import zip_longest
keyspace = self.redis_conn.info('keyspace').get('db1', {}) .get('keys', 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. This hard-codes the DB ID, don't we have that info in an environment variable somewhere?
  2. Should there be some exception or other log message if it can't connect or get the keys, instead of defaulting to 1?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. we are using db1 (here
    db=1) # uses db1 for isolation @TODO make this config param.
    ) maybe we should make that an env var and resolve as such.
  2. if it can't connect it would raise an error, but if keyspace['db1'] doesn't have any value it just means that its empty , so by defaulting to one we the next call to get all keys would have empty list. we can return empty list if keyspace[db1] is empty though

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I have added a new config under kgx section in the config.yaml merge_db_id that would be used to choose a redis db id .
  2. added a better way of dealing with empty keyspace

add better keyspace detection

@cschreep cschreep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@YaphetKG
YaphetKG merged commit ef1667d into develop Nov 2, 2021
@YaphetKG
YaphetKG deleted the patch/batch-iter-redis-keys branch November 2, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants