swlib / archer Goto Github PK
View Code? Open in Web Editor NEW基于协程Swoole的Task组件,支持多种模式。轻松实现协程Task的队列、并发、Defer、计时器等 | Swoole coroutine task kit - Swoole Humanization Library
License: Apache License 2.0
基于协程Swoole的Task组件,支持多种模式。轻松实现协程Task的队列、并发、Defer、计时器等 | Swoole coroutine task kit - Swoole Humanization Library
License: Apache License 2.0
在 MultiTask中,有些代码不太理解,希望能够得到解释,比如在yieldEachOne中
if (0 === $unfinished_task_count) { foreach ($this->result_map as $k => $v) { yield $k => $v; } return $this->result_map; }
如题
<?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 方法 我启动框架 定时器开始计时 我把框架结束后 定时器的任务进程没有结束
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.