swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

定时任务执行报错(基于docker) #416

Closed cirvor closed 6 years ago

cirvor commented 6 years ago
Q A
Bug report? yes
Feature request? no
Swoft version ^1.0
Swoole version 4.0.3
PHP version 7.1.23
Runtime environment Docker

Details 都是基于官方Docker镜像执行,本地执行没有问题 上传到测试环境执行报错:

[TaskEventListener.php:45,Swoft\Task\Bootstrap\Listeners\TaskEventListener->onTask] TaskExecutor->run Call to undefined method SyncTask_5bcd41bedd35e::cronTask() file=/var/www/swoft/vendor/swoft/framework/src/Helper/PhpHelper.php line=47

cirvor commented 6 years ago

已解决 定义任务时 需要设置一个唯一的name

/**
 * Demo task
 *
 * @Task("demo")
 */
class DemoTask
{
}