Code Monkey home page Code Monkey logo

redis-queue's Introduction

redis-queue's People

Contributors

krissss avatar lengqiuqiuqiu avatar tinywan avatar walkor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redis-queue's Issues

restart 报错了

restart 报错了

Class 'support\Container' not found in webman/redis-queue/src/Process/Consumer.php:56

无法下载呀?需要token

无法下载呀?需要token
` Failed to download workerman/redis from dist: curl error 7 while downloading https://api.github.com/repos/walkor/redis/zipball/f28f9d71ad6cd7431e1974ade8d30bca98dec49a: Failed to connect to api.github.com port 443: Connection re
fused
Now trying to download from source

这是啥意思?

延迟队列,为啥一次性只拉取128个

我这边在拉取延迟队列的时候发现消费的比较慢,看了一下源码一次性只拉取了128个,想咨询一下大佬这样设计的想法是啥?

    $retry_timer = Timer::add(1, function () {
            $now = time();
            $options = ['LIMIT', 0, 128];
            $this->_redisSend->zrevrangebyscore(static::QUEUE_DELAYED, $now, '-inf', $options, function($items){
                if ($items === false) {
                    throw new RuntimeException($this->_redisSend->error());
                }
                foreach ($items as $package_str) {
                    $this->_redisSend->zRem(static::QUEUE_DELAYED, $package_str, function ($result) use ($package_str) {
                        if ($result !== 1) {
                            return;
                        }
                        $package = \json_decode($package_str, true);
                        if (!$package) {
                            $this->_redisSend->lPush(static::QUEUE_FAILD , $package_str);
                            return;
                        }
                        $this->_redisSend->lPush(static::QUEUE_WAITING . $package['queue'], $package_str);
                    });
                }
            });
        });

Consumer 文件类也可这样写。

$class = str_replace('/', "\\", substr(substr($file, strlen(base_path())), 0, -4));

$class = str_replace([base_path(), '/', '.php'], ["", "\\", ''], $file);

这样看起来更容易明白

如何优雅的抛出异常?

throw new \Excption('异常');
这样异常给redis弄了一堆报错打印

尝试以下操作

1. config/app.php

debug=>false
error_reporting=>1024

这个是webman的错误打印配置

2.尝试使用trigger_error("超时重试2",E_USER_NOTICE)

还是会打印错误堆栈

找寻源码 webman/queue 是对 workerman/redis-queue的优雅封装,搞不定

因为我已经选择主动抛出异常重试,堆栈信息是否保存到redis起码可选的吧~ redis - fail表体积爆炸

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.