diff --git a/src/Resources/config/services/scheduled_tasks.xml b/src/Resources/config/services/scheduled_tasks.xml
index 5ab26627a..062ac68c2 100755
--- a/src/Resources/config/services/scheduled_tasks.xml
+++ b/src/Resources/config/services/scheduled_tasks.xml
@@ -22,6 +22,12 @@
+
+
+
+
+
+
diff --git a/src/ScheduledTask/OrderStatus/ExpireOrderTaskHandler.php b/src/ScheduledTask/OrderStatus/ExpireOrderTaskHandler.php
index 0db5eb32a..cd2f5b387 100644
--- a/src/ScheduledTask/OrderStatus/ExpireOrderTaskHandler.php
+++ b/src/ScheduledTask/OrderStatus/ExpireOrderTaskHandler.php
@@ -13,6 +13,7 @@
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
#[\Symfony\Component\Messenger\Attribute\AsMessageHandler(handles: ExpireOrderTask::class)]
@@ -40,6 +41,8 @@ public function run(): void
$criteria = new Criteria();
$criteria->addAssociation('transactions.stateMachineState');
$criteria->getAssociation('transactions.stateMachineState')->addFilter(new EqualsFilter('technicalName', OrderStates::STATE_IN_PROGRESS));
+ $criteria->addSorting(new FieldSorting('orderDateTime', FieldSorting::DESCENDING));
+ $criteria->setLimit(10);
$this->logger->debug('Search for orders which are in progress state');
diff --git a/src/ScheduledTask/Subscription/RenewalReminder/AbstractRenewalReminderTaskHandler.php b/src/ScheduledTask/Subscription/RenewalReminder/AbstractRenewalReminderTaskHandler.php
new file mode 100755
index 000000000..ac07f126c
--- /dev/null
+++ b/src/ScheduledTask/Subscription/RenewalReminder/AbstractRenewalReminderTaskHandler.php
@@ -0,0 +1,69 @@
+getRepository(), $logger);
+
+ $this->subscriptionManager = $subscriptionManager;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @return iterable
+ */
+ public static function getHandledMessages(): iterable
+ {
+ return [
+ RenewalReminderTask::class,
+ RenewalReminderTaskDev::class,
+ ];
+ }
+
+ /**
+ *
+ */
+ public function run(): void
+ {
+ try {
+ $this->logger->info('Starting Subscription Renewal Reminder from Scheduled Tasks.');
+
+ $context = new Context(new SystemSource());
+
+ $remindedCount = $this->subscriptionManager->remindSubscriptionRenewal($context);
+
+ $this->logger->debug($remindedCount . ' subscriptions renewal reminders have been processed successfully!');
+ } catch (\Throwable $ex) {
+ $this->logger->error(
+ 'Error when running Scheduled Task for Subscription Renewal Reminders. ' . $ex->getMessage()
+ );
+ }
+ }
+}
diff --git a/src/ScheduledTask/Subscription/RenewalReminder/RenewalReminderTaskDevHandler.php b/src/ScheduledTask/Subscription/RenewalReminder/RenewalReminderTaskDevHandler.php
new file mode 100644
index 000000000..693fa35f1
--- /dev/null
+++ b/src/ScheduledTask/Subscription/RenewalReminder/RenewalReminderTaskDevHandler.php
@@ -0,0 +1,9 @@
+getRepository(), $logger);
-
- $this->subscriptionManager = $subscriptionManager;
- $this->logger = $logger;
- }
-
- /**
- * @return iterable
- */
- public static function getHandledMessages(): iterable
- {
- return [
- RenewalReminderTask::class,
- RenewalReminderTaskDev::class,
- ];
- }
-
- /**
- *
- */
- public function run(): void
- {
- try {
- $this->logger->info('Starting Subscription Renewal Reminder from Scheduled Tasks.');
-
- $context = Context::createDefaultContext();
-
- $remindedCount = $this->subscriptionManager->remindSubscriptionRenewal($context);
-
- $this->logger->debug($remindedCount . ' subscriptions renewal reminders have been processed successfully!');
- } catch (\Throwable $ex) {
- $this->logger->error(
- 'Error when running Scheduled Task for Subscription Renewal Reminders. ' . $ex->getMessage()
- );
- }
- }
}