Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update number of results returned by scan_iter in Redis state manager #1455

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions turbinia/state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_task_data(
"""
tasks = [
json.loads(self.client.get(task))
for task in self.client.scan_iter('TurbiniaTask:*')
for task in self.client.scan_iter(match='TurbiniaTask:*', count=1000)
if json.loads(self.client.get(task)).get('instance') == instance or
not instance
]
Expand Down Expand Up @@ -339,7 +339,7 @@ def iterate_keys(self, key_type: str) -> Iterator[str]:
decode fails.
"""
try:
keys = self.client.scan_iter(f'Turbinia{key_type.title()}:*')
keys = self.client.scan_iter(f'Turbinia{key_type.title()}:*', count=1000)
except redis.RedisError as exception:
error_message = f'Error getting {key_type} keys in Redis'
log.error(f'{error_message}: {exception}')
Expand All @@ -366,7 +366,7 @@ def iterate_attributes(self, key: str) -> Iterator[tuple]:
decode or json loads fails.
"""
try:
attributes = self.client.hscan_iter(key)
attributes = self.client.hscan_iter(key, count=100)
except redis.RedisError as exception:
error_message = f'Error getting attributes from {key} in Redis'
log.error(f'{error_message}: {exception}')
Expand Down
Loading