Skip to content

Commit fbad1da

Browse files
author
Oleksandr Iegorov
committed
Merge branch 'MAGETWO-84646' of https://github.com/magento-tango/magento2ce into 2.2.2-develop-PR
2 parents fa9c9cc + f95a421 commit fbad1da

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

app/code/Magento/Cron/Model/ResourceModel/Schedule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public function trySetJobUniqueStatusAtomic($scheduleId, $newStatus, $currentSta
7575
)
7676
->where('current.schedule_id = ?', $scheduleId)
7777
->where('current.status = ?', $currentStatus)
78-
->where('existing.schedule_id IS NULL');
78+
->where('existing.schedule_id IS NULL')
79+
->where('existing.executed_at > UTC_TIMESTAMP() - INTERVAL 1 DAY'); //hotfix
7980

8081
$update = $connection->updateFromSelect($selectIfUnlocked, ['current' => $this->getTable('cron_schedule')]);
8182
$result = $connection->query($update)->rowCount();
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cron\Setup;
8+
9+
10+
use Magento\Framework\Setup\InstallSchemaInterface;
11+
use Magento\Framework\Setup\ModuleContextInterface;
12+
use Magento\Framework\Setup\SchemaSetupInterface;
13+
14+
/**
15+
* @codeCoverageIgnore
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
*/
18+
class Recurring implements InstallSchemaInterface
19+
{
20+
/**
21+
* @var \Magento\Cron\Model\ResourceModel\Schedule
22+
*/
23+
private $schedule;
24+
25+
/**
26+
* Recurring constructor.
27+
* @param \Magento\Cron\Model\ResourceModel\Schedule $schedule
28+
*/
29+
public function __construct(
30+
\Magento\Cron\Model\ResourceModel\Schedule $schedule
31+
) {
32+
33+
$this->schedule = $schedule;
34+
}
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
40+
{
41+
42+
$connection = $this->schedule->getConnection();
43+
$connection->update(
44+
$this->schedule->getMainTable(),
45+
[
46+
'status' => \Magento\Cron\Model\Schedule::STATUS_ERROR,
47+
'messages' => 'The job is terminated due to system upgrade'
48+
],
49+
$connection->quoteInto('status = ?', \Magento\Cron\Model\Schedule::STATUS_RUNNING)
50+
);
51+
}
52+
}

0 commit comments

Comments
 (0)