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

perf: redis block with keys command #1423

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

rfyiamcool
Copy link
Contributor

@rfyiamcool rfyiamcool commented Nov 16, 2023

summary

pervent redis block when use keys * command to request redis.

  1. replace redis.keys to redis.scan.
  2. the redis of many companies don't support the keys command, Or deny keys command.

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Copy link
Contributor

sweep-ai bot commented Nov 16, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (a19f0e5) 4.54% compared to head (7f4705d) 4.98%.

Files Patch % Lines
pkg/common/db/cache/msg.go 63.63% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1423      +/-   ##
========================================
+ Coverage   4.54%   4.98%   +0.44%     
========================================
  Files         49      49              
  Lines       4140    4152      +12     
========================================
+ Hits         188     207      +19     
+ Misses      3940    3933       -7     
  Partials      12      12              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@cubxxw cubxxw left a comment

Choose a reason for hiding this comment

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

When using the Keys command, be aware that it can cause performance problems in a database with a large number of keys because it requires scanning the entire key space to find a matching key. In a production environment, the SCAN command is recommended because it is designed to iterate over large databases more efficiently.

@cubxxw cubxxw added this pull request to the merge queue Nov 26, 2023
Merged via the queue into openimsdk:main with commit 403cfb6 Nov 26, 2023
21 checks passed
@github-actions github-actions bot added this to the v3.1 milestone Nov 26, 2023
@openimsdk openimsdk locked and limited conversation to collaborators Nov 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants