vendor/shopware/core/Framework/MessageQueue/Api/ScheduledTaskController.php line 23

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\MessageQueue\Api;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\Framework\MessageQueue\ScheduledTask\Scheduler\TaskScheduler;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. #[Route(defaults: ['_routeScope' => ['api']])]
  9. #[Package('system-settings')]
  10. class ScheduledTaskController extends AbstractController
  11. {
  12.     /**
  13.      * @internal
  14.      */
  15.     public function __construct(private readonly TaskScheduler $taskScheduler)
  16.     {
  17.     }
  18.     #[Route(path'/api/_action/scheduled-task/run'name'api.action.scheduled-task.run'methods: ['POST'])]
  19.     public function runScheduledTasks(): JsonResponse
  20.     {
  21.         $this->taskScheduler->queueScheduledTasks();
  22.         return $this->json(['message' => 'Success']);
  23.     }
  24.     #[Route(path'/api/_action/scheduled-task/min-run-interval'name'api.action.scheduled-task.min-run-interval'methods: ['GET'])]
  25.     public function getMinRunInterval(): JsonResponse
  26.     {
  27.         return $this->json(['minRunInterval' => $this->taskScheduler->getMinRunInterval()]);
  28.     }
  29. }