Skip to content

Commit

Permalink
Add fix for scheduled tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Radomir98 committed Nov 7, 2024
1 parent 2920e0e commit 6f24819
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: DailyProductSyncScheduledTask::class)]
class DailyProductSyncScheduledTaskHandler extends ScheduledTaskHandler
{
private const LAST_EXECUTION_TIME_CONFIG = 'dailySyncLastTime';
Expand All @@ -36,14 +38,6 @@ public function __construct(
parent::__construct($scheduledTaskRepository);
}

/**
* @return ScheduledTask[]
*/
public static function getHandledMessages(): iterable
{
return [DailyProductSyncScheduledTask::class];
}

public function run(): void
{
if ($this->isTimeToRunJob()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Shopware\Core\Framework\Uuid\Uuid;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: EntityChangelogScheduledTask::class)]
class EntityChangelogScheduledTaskHandler extends ScheduledTaskHandler implements GeneratingHandlerInterface
{
public function __construct(
Expand All @@ -21,14 +23,6 @@ public function __construct(
parent::__construct($scheduledTaskRepository);
}

/**
* @return ScheduledTask[]
*/
public static function getHandledMessages(): iterable
{
return [EntityChangelogScheduledTask::class];
}

public function run(): void
{
$jobMessage = new EntityChangelogSyncMessage(Uuid::randomHex());
Expand Down
10 changes: 2 additions & 8 deletions src/Service/ScheduledTask/OldJobCleanupScheduledTaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Throwable;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: OldJobCleanupScheduledTask::class)]
class OldJobCleanupScheduledTaskHandler extends ScheduledTaskHandler
{
public function __construct(
Expand All @@ -31,14 +33,6 @@ public function __construct(
parent::__construct($scheduledTaskRepository);
}

/**
* @return ScheduledTask[]
*/
public static function getHandledMessages(): iterable
{
return [OldJobCleanupScheduledTask::class];
}

public function run(): void
{
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
use Throwable;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler(handles: OldNostoDataCleanupScheduledTask::class)]
class OldNostoDataCleanupScheduledTaskHandler extends ScheduledTaskHandler
{
public function __construct(
Expand All @@ -25,14 +27,6 @@ public function __construct(
parent::__construct($scheduledTaskRepository);
}

/**
* @return ScheduledTask[]
*/
public static function getHandledMessages(): iterable
{
return [OldNostoDataCleanupScheduledTask::class];
}

public function run(): void
{
try {
Expand Down

0 comments on commit 6f24819

Please sign in to comment.