vendor/shopware/core/Framework/MessageQueue/ScheduledTask/Api/ScheduledTaskController.php line 38

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