We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在config/autoload/redis.php 中配置 Redis::OPT_SERIALIZER => Redis::SERIALIZER_JSON,如下图:
Redis::OPT_SERIALIZER => Redis::SERIALIZER_JSON
<?php declare(strict_types=1); use function Hyperf\Support\env; return [ 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), 'auth' => env('REDIS_AUTH', null), 'port' => (int) env('REDIS_PORT', 6379), 'db' => (int) env('REDIS_DB', 0), 'pool' => [ 'min_connections' => 1, 'max_connections' => 10, 'connect_timeout' => 10.0, 'wait_timeout' => 3.0, 'heartbeat' => -1, 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60), ], 'options' => [ Redis::OPT_SERIALIZER => Redis::SERIALIZER_JSON, // 加入此行配置,就会存在问题 Redis::OPT_READ_TIMEOUT => -1, ], ], ];
因为vendor/hyperf/rate-limit/src/Aspect/RateLimitAnnotationAspect.php文件中第67-73行进行了try catch并且没有对外抛错,导致错误一直正确的抛出来,调试了很久,建议此处也正确的将错误抛出来,就不用排查那么久了……
vendor/hyperf/rate-limit/src/Aspect/RateLimitAnnotationAspect.php
原因是vendor/hyperf/rate-limit/src/Storage/RedisStorage.php文件中第90-92行:$data = DoublePacker::pack($microtime);在pack之后的值存入redis中是空字符串导致的问题
vendor/hyperf/rate-limit/src/Storage/RedisStorage.php
$data = DoublePacker::pack($microtime);
The text was updated successfully, but these errors were encountered:
你都已经定位好问题了,不考虑一下自己提交PR吗 (* ̄︶ ̄)
Sorry, something went wrong.
我想改的,但是问题是在redis组件中,redis组件七拐八绕,没有设计文档,不敢轻易下手
刚刚又研究了下,有解决方案,可以在redis的配置文件中新增一套配置给rate-limit用即可。 不过还是可以优化一下报错,检测到用户配置了序列化抛出正确的错误,不然下次遇到问题又要排查很久……
No branches or pull requests
Description:
在config/autoload/redis.php 中配置
Redis::OPT_SERIALIZER => Redis::SERIALIZER_JSON
,如下图:因为
vendor/hyperf/rate-limit/src/Aspect/RateLimitAnnotationAspect.php
文件中第67-73行进行了try catch并且没有对外抛错,导致错误一直正确的抛出来,调试了很久,建议此处也正确的将错误抛出来,就不用排查那么久了……原因是
vendor/hyperf/rate-limit/src/Storage/RedisStorage.php
文件中第90-92行:$data = DoublePacker::pack($microtime);
在pack之后的值存入redis中是空字符串导致的问题The text was updated successfully, but these errors were encountered: