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

feat: Limit Redis Stream length #834

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Conversation

morgsmccauley
Copy link
Collaborator

This PR introduces back pressure to the Redis Stream in Block Streamer, ensuring that the stream does not exceed a specified maximum length. This is achieved by blocking the redis.publish_block() call, intermittently polling the Stream length, and publishing once it falls below the configured limit.

To aid testing, the current RedisClient struct has been split in to two:

  • RedisCommands - thin wrapper around redis commands to make mocking possible.
  • RedisClient - provides higher-level redis functionality, e.g. "publishing blocks", utilising the above.

In most cases, RedisClient will be used. The split just allows us to test RedisWrapper itself.

@morgsmccauley morgsmccauley requested a review from a team as a code owner June 25, 2024 09:00
@morgsmccauley morgsmccauley linked an issue Jun 25, 2024 that may be closed by this pull request
@morgsmccauley morgsmccauley merged commit f52dfa3 into main Jun 25, 2024
4 checks passed
@morgsmccauley morgsmccauley deleted the feat/limit-redis-stream-length branch June 25, 2024 21:27
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.

Cap the block stream length
1 participant