hyperf / hyperf/swow-skeleton

Crontab 开启 onOneServer true 会报错

Open
#15 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
49
Forks
9
PR merge metrics
No merged PRs in 30d

Description

环境:swow-skeleton: 3.0
swow: 1.0

```php
#[Crontab(rule: "* * * * * *", name: "Foo", callback: "execute", memo: "这是一个示例的定时任务")]
class FooTask
{
#[Inject]
private StdoutLoggerInterface $logger;

public function execute(): void
{
$this->logger->info(date('Y-m-d H:i:s', time()));
}

#[Crontab(rule: "* * * * * *", memo: "foo")]
public function foo(): void
{
var_dump('foo');
}
}
```

已设置 :

```php
// config/autoload/processes.php
return [
Hyperf\Crontab\Process\CrontabDispatcherProcess::class,
];
```

```php
// config/autoload/dependencies.php
return [
# crontab 协程模式调度器
Hyperf\Crontab\Strategy\StrategyInterface::class => Hyperf\Crontab\Strategy\CoroutineStrategy::class,
]
```

```php
// config/autoload/crontab.php
return [
'enable' => true,
'crontab' => [
],
];

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.