Giter Site home page Giter Site logo

swlib / archer Goto Github PK

View Code? Open in Web Editor NEW
142.0 10.0 26.0 37 KB

基于协程Swoole的Task组件,支持多种模式。轻松实现协程Task的队列、并发、Defer、计时器等 | Swoole coroutine task kit - Swoole Humanization Library

License: Apache License 2.0

PHP 100.00%
swoole coroutine archer taskqueue timer php csp

archer's People

Contributors

fdreamsu avatar twose 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  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  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  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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archer's Issues

[疑问]MultiTask

在 MultiTask中,有些代码不太理解,希望能够得到解释,比如在yieldEachOne中
if (0 === $unfinished_task_count) { foreach ($this->result_map as $k => $v) { yield $k => $v; } return $this->result_map; }

在swoft框架中引入此包,运行定时器, swoft框架定时器结束后 archer的进程将会成为僵尸进程

<?php declare(strict_types=1);

namespace App\Listener;

use App\Rpc\Lib\RedisServiceInterface;
use Swoft\Event\Annotation\Mapping\Listener;
use Swoft\Event\EventHandlerInterface;
use Swoft\Event\EventInterface;
use Swoft\Log\Helper\CLog;
use Swoft\Rpc\Client\Annotation\Mapping\Reference;
use Swoft\SwoftEvent;
use Swlib\Archer;

/**
 * Class AttachMyProcessHandler
 * @Listener(SwoftEvent::APP_INIT_COMPLETE)
 */
class ClearListener implements EventHandlerInterface
{
    /**
     * @Reference(pool="redis_client.pool")
     * @var RedisServiceInterface
     */
    private $redisClient;
    /**
     * @param EventInterface $event
     */
    public function handle(EventInterface $event): void
    {
        $taskId = Archer::taskTimerAfter(10,function (){
//            $this->redisClient->clearAll();
            CLog::error('123123123123123');
            $taskId = Archer\Task::getCurrentTaskId();
//            Archer::clearTimerTask($taskId);
            Archer\TimerHeap::stop();

        });
    }
}

这段代码 在swoft中的意思是 当框架出事话完成后执行 handle 方法 我启动框架 定时器开始计时 我把框架结束后 定时器的任务进程没有结束

主进程已经结束

image

但是依附于主进程的archer 并没有结束 我也不知道是 archer的问题还是swoft的问题

image

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.