Skip to content

Commit d20f403

Browse files
committed
Use separate group & process for cron jobs
1 parent e4103df commit d20f403

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

Cron/CleanCron.php renamed to Cron/Cleaner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\Exception\LocalizedException;
1212
use Opengento\WebapiLogger\Model\Clean;
1313

14-
class CleanCron
14+
class Cleaner
1515
{
1616
public function __construct(private Clean $clean) {}
1717

etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ password
2020
token
2121
email</secret_words>
2222
<clean_older_than_hours>24</clean_older_than_hours>
23+
<clean_scheduler>0 * * * *</clean_scheduler>
2324
</log>
2425
</webapi_logs>
2526
</default>

etc/cron_groups.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © OpenGento, All rights reserved.
5+
* See LICENSE bundled with this library for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/cron_groups.xsd">
9+
<group id="opengento_webapi_logger">
10+
<schedule_generate_every>1</schedule_generate_every>
11+
<schedule_ahead_for>4</schedule_ahead_for>
12+
<schedule_lifetime>2</schedule_lifetime>
13+
<history_cleanup_every>10</history_cleanup_every>
14+
<history_success_lifetime>60</history_success_lifetime>
15+
<history_failure_lifetime>600</history_failure_lifetime>
16+
<use_separate_process>1</use_separate_process>
17+
</group>
18+
</config>

etc/crontab.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
9-
<group id="default">
10-
<job name="webapilogs_clean" instance="Opengento\WebapiLogger\Cron\CleanCron" method="execute">
11-
<schedule>0 * * * *</schedule>
9+
<group id="opengento_webapi_logger">
10+
<job name="opengento_webapi_logger_cleaner" instance="Opengento\WebapiLogger\Cron\Cleaner" method="execute">
11+
<config_path>webapi_logs/log/clean_scheduler</config_path>
1212
</job>
1313
</group>
1414
</config>

0 commit comments

Comments
 (0)