hyperf / hyperf/socketio-server

【BUG】 socketio:clear 命令异常, 当 redis 配置了 prefix 选项后,一定会出现清除失败!

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
26
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Image

redis配置了前缀,并且 scan 配置了Redis::SCAN_PREFIX (其实配置不配置,都会出现问题,只要redis的options配置了前缀)

情况1:
当 scan 选项没有配置时,则scan默认为不加前缀,则调用 scan 命令获取不到keys,所以就没有清除的效果

情况2:
当 scan 选项配置为Redis::SCAN_PREFIX 时,则调用scan 命令能获取到keys, 但这些key是原始的key (添加了前缀), 则调用 del 命令会失败 (因为del也会自动添加前缀,就导致添加了两次前缀).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the socketio:clear command and how its Redis scan and delete operations handle configured prefixes. Reproduce the issue with a Redis prefix, testing both the default scan behavior and Redis::SCAN_PREFIX. Done means the command finds and deletes the intended keys without applying the prefix twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, redis
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.