Skip to content

Commit

Permalink
Automatically schedule log cleaner every day
Browse files Browse the repository at this point in the history
  • Loading branch information
apfelbox committed Jun 19, 2024
1 parent 16ad7a6 commit 50abb5a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"symfony/event-dispatcher-contracts": "^3.4",
"symfony/http-kernel": "^7.0",
"symfony/messenger": "^7.0",
"symfony/scheduler": "^7.1",
"symfony/string": "^7.0",
"symfony/uid": "^7.0"
},
Expand Down
27 changes: 27 additions & 0 deletions src/Schedule/TaskManagerSchedule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types=1);

namespace Torr\TaskManager\Schedule;

use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Torr\TaskManager\Log\Task\CleanOutdatedLogsTask;

#[AsSchedule]
final readonly class TaskManagerSchedule implements ScheduleProviderInterface
{
/**
*
*/
public function getSchedule () : Schedule
{
return (new Schedule())
->with(
RecurringMessage::cron(
"#daily",
new CleanOutdatedLogsTask(),
),
);
}
}

0 comments on commit 50abb5a

Please sign in to comment.