Created
January 22, 2024 02:22
-
-
Save mmouih/2334534f62f9070250518e2389921ee1 to your computer and use it in GitHub Desktop.
AsPeriodicTask usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Service; | |
use Symfony\Component\Scheduler\Attribute\AsPeriodicTask; | |
class MyService | |
{ | |
#[AsPeriodicTask(schedule: 'watchdog_attribute', frequency: '5 seconds', jitter: 10)] | |
public function monitoring(): void | |
{ | |
// ... Monitoring logic here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Scheduler; | |
use Symfony\Component\Scheduler\Attribute\AsPeriodicTask; | |
#[AsPeriodicTask(schedule: 'watchdog_attribute', frequency: '5 seconds', jitter: 10)] | |
class WatchDogWithAttributeScheduleProvider | |
{ | |
public function __invoke() | |
{ | |
// ... Monitoring logic here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment