Skip to content

Commit 4f857ef

Browse files
authored
Merge pull request #91 from magento-commerce/develop
MCLOUD-11596: Release Cloud Tools
2 parents 3622772 + d8e76cc commit 4f857ef

5 files changed

+200
-9
lines changed

.github/.metadata.json

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"templateVersion": "0.1",
2+
"templateVersion": "0.2",
33
"product": {
44
"name": "Magento Cloud Patches",
55
"description": "The Magento Cloud Patches package is a set of patches, previously used within the ece-tools package to improve the integration of all Magento versions with Cloud environments and to deliver critical fixes quickly"
66
},
77
"contacts": {
88
"team": {
9-
"name": "Magic Mountain",
10-
"DL": "Grp-magento-cloud-all",
11-
"slackChannel": "magic_mountain"
9+
"name": "Mystic Mountain",
10+
"DL": "Grp-Mystic-Mountain",
11+
"slackChannel": "#mystic-mountain-team"
1212
}
1313
},
1414
"ticketTracker": {
@@ -17,10 +17,8 @@
1717
},
1818
"securityJiraQueue": {
1919
"projectKey": "MAGREQ",
20-
"component": "Magento Cloud Engineering"
20+
"component": "MAGREQ/Magento Cloud Engineering"
2121
}
2222
},
23-
"staticScan": {
24-
"enable": false
25-
}
23+
"productionCodeBranches": ["1.0"]
2624
}

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.0.24",
5+
"version": "1.0.25",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {

patches.json

+6
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@
274274
},
275275
"Reduced the number of times the same deployment configurations load": {
276276
">=2.4.6 <2.4.6-p2": "MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch"
277+
},
278+
"Fixes the issue where missed jobs unnecessarily wait for cron job locks.": {
279+
">=2.4.4 <2.4.7": "MCLOUD-11329__missed_jobs_unnecessarily_wait_for_cron_job_locks__2.4.6.patch"
280+
},
281+
"Enhanced Layout Cache Efficiency (memory usage reduced)": {
282+
">=2.4.4 <2.4.7": "MCLOUD-11514__enhanced_layout_cache_efficiency__2.4.6-p3.patch"
277283
}
278284
},
279285
"magento/module-paypal": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
diff --git a/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php b/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
2+
index a4a11156956d..d58e60ba2cab 100644
3+
--- a/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
4+
+++ b/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
5+
@@ -320,17 +320,11 @@ private function lockGroup(string $groupId, callable $callback): void
6+
*
7+
* @return void
8+
* @throws Exception|Throwable
9+
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
10+
*/
11+
protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, $groupId)
12+
{
13+
$jobCode = $schedule->getJobCode();
14+
- $scheduleLifetime = $this->getCronGroupConfigurationValue($groupId, self::XML_PATH_SCHEDULE_LIFETIME);
15+
- $scheduleLifetime = $scheduleLifetime * self::SECONDS_IN_MINUTE;
16+
- if ($scheduledTime < $currentTime - $scheduleLifetime) {
17+
- $schedule->setStatus(Schedule::STATUS_MISSED);
18+
- // phpcs:ignore Magento2.Exceptions.DirectThrow
19+
- throw new Exception(sprintf('Cron Job %s is missed at %s', $jobCode, $schedule->getScheduledAt()));
20+
- }
21+
22+
if (!isset($jobConfig['instance'], $jobConfig['method'])) {
23+
$schedule->setStatus(Schedule::STATUS_ERROR);
24+
@@ -832,7 +826,7 @@ private function processPendingJobs(string $groupId, array $jobsRoot, int $curre
25+
}
26+
27+
$scheduledTime = strtotime($schedule->getScheduledAt());
28+
- if ($scheduledTime > $currentTime) {
29+
+ if (!$this->shouldRunJob($schedule, $groupId, $currentTime, (int) $scheduledTime)) {
30+
continue;
31+
}
32+
33+
@@ -929,4 +923,62 @@ function () use ($scheduleResource, $where) {
34+
$scheduleResource->getConnection()
35+
);
36+
}
37+
+
38+
+ /**
39+
+ * Mark job as missed
40+
+ *
41+
+ * @param Schedule $schedule
42+
+ * @return void
43+
+ */
44+
+ private function markJobAsMissed(Schedule $schedule): void
45+
+ {
46+
+ $jobCode = $schedule->getJobCode();
47+
+ $scheduleId = $schedule->getId();
48+
+ $resource = $schedule->getResource();
49+
+ $connection = $resource->getConnection();
50+
+ $message = sprintf('Cron Job %s is missed at %s', $jobCode, $schedule->getScheduledAt());
51+
+ $result = $this->retrier->execute(
52+
+ function () use ($resource, $connection, $scheduleId, $message) {
53+
+ return $connection->update(
54+
+ $resource->getTable('cron_schedule'),
55+
+ ['status' => Schedule::STATUS_MISSED, 'messages' => $message],
56+
+ ['schedule_id = ?' => $scheduleId, 'status = ?' => Schedule::STATUS_PENDING]
57+
+ );
58+
+ },
59+
+ $connection
60+
+ );
61+
+ if ($result == 1) {
62+
+ $schedule->setStatus(Schedule::STATUS_MISSED);
63+
+ $schedule->setMessages($message);
64+
+ if ($this->state->getMode() === State::MODE_DEVELOPER) {
65+
+ $this->logger->info($message);
66+
+ }
67+
+ }
68+
+ }
69+
+
70+
+ /**
71+
+ * Check if job should be run
72+
+ *
73+
+ * @param Schedule $schedule
74+
+ * @param string $groupId
75+
+ * @param int $currentTime
76+
+ * @param int $scheduledTime
77+
+ * @return bool
78+
+ */
79+
+ private function shouldRunJob(Schedule $schedule, string $groupId, int $currentTime, int $scheduledTime): bool
80+
+ {
81+
+ if ($scheduledTime > $currentTime) {
82+
+ return false;
83+
+ }
84+
+
85+
+ $scheduleLifetime = $this->getCronGroupConfigurationValue($groupId, self::XML_PATH_SCHEDULE_LIFETIME);
86+
+ $scheduleLifetime = $scheduleLifetime * self::SECONDS_IN_MINUTE;
87+
+
88+
+ if ($scheduledTime < $currentTime - $scheduleLifetime) {
89+
+ $this->markJobAsMissed($schedule);
90+
+ return false;
91+
+ }
92+
+
93+
+ return true;
94+
+ }
95+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
diff --git a/vendor/magento/framework/App/Cache/Type/Layout.php b/vendor/magento/framework/App/Cache/Type/Layout.php
2+
index 2ea069a..57b1cb4 100644
3+
--- a/vendor/magento/framework/App/Cache/Type/Layout.php
4+
+++ b/vendor/magento/framework/App/Cache/Type/Layout.php
5+
@@ -3,6 +3,8 @@
6+
* Copyright © Magento, Inc. All rights reserved.
7+
* See COPYING.txt for license details.
8+
*/
9+
+declare(strict_types=1);
10+
+
11+
namespace Magento\Framework\App\Cache\Type;
12+
13+
/**
14+
@@ -11,14 +13,29 @@ namespace Magento\Framework\App\Cache\Type;
15+
class Layout extends \Magento\Framework\Cache\Frontend\Decorator\TagScope
16+
{
17+
/**
18+
+ * Prefix for hash kay and hash data
19+
+ */
20+
+ public const HASH_PREFIX = 'l:';
21+
+
22+
+ /**
23+
+ * Hash type, not used for security, only for uniqueness
24+
+ */
25+
+ public const HASH_TYPE = 'xxh3';
26+
+
27+
+ /**
28+
+ * Data lifetime in milliseconds
29+
+ */
30+
+ public const DATA_LIFETIME = 86_400_000; // "1 day" milliseconds
31+
+
32+
+ /**
33+
* Cache type code unique among all cache types
34+
*/
35+
- const TYPE_IDENTIFIER = 'layout';
36+
+ public const TYPE_IDENTIFIER = 'layout';
37+
38+
/**
39+
* Cache tag used to distinguish the cache type from all other cache
40+
*/
41+
- const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG';
42+
+ public const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG';
43+
44+
/**
45+
* @param FrontendPool $cacheFrontendPool
46+
@@ -27,4 +44,33 @@ class Layout extends \Magento\Framework\Cache\Frontend\Decorator\TagScope
47+
{
48+
parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
49+
}
50+
+
51+
+ /**
52+
+ * @inheritDoc
53+
+ */
54+
+ public function save($data, $identifier, array $tags = [], $lifeTime = null)
55+
+ {
56+
+ $dataHash = hash(self::HASH_TYPE, $data);
57+
+ $identifierForHash = self::HASH_PREFIX . $dataHash;
58+
+ return parent::save($data, $identifierForHash, $tags, self::DATA_LIFETIME) // key is hash of data hash
59+
+ && parent::save(self::HASH_PREFIX . $dataHash, $identifier, $tags, $lifeTime); // store hash of data
60+
+ }
61+
+
62+
+ /**
63+
+ * @inheritDoc
64+
+ */
65+
+ public function load($identifier)
66+
+ {
67+
+ $data = parent::load($identifier);
68+
+ if ($data === false || $data === null) {
69+
+ return $data;
70+
+ }
71+
+
72+
+ if (str_starts_with($data, self::HASH_PREFIX)) {
73+
+ // so data stored in other place
74+
+ return parent::load($data);
75+
+ } else {
76+
+ return $data;
77+
+ }
78+
+ }
79+
}
80+
diff --git a/vendor/magento/framework/Cache/Backend/Redis.php b/vendor/magento/framework/Cache/Backend/Redis.php
81+
index 565777d..9527ebc 100644
82+
--- a/vendor/magento/framework/Cache/Backend/Redis.php
83+
+++ b/vendor/magento/framework/Cache/Backend/Redis.php
84+
@@ -70,7 +70,7 @@ class Redis extends \Cm_Cache_Backend_Redis
85+
* @param bool $specificLifetime
86+
* @return bool
87+
*/
88+
- public function save($data, $id, $tags = [], $specificLifetime = false)
89+
+ public function save($data, $id, $tags = [], $specificLifetime = 86_400_000)
90+
{
91+
try {
92+
$result = parent::save($data, $id, $tags, $specificLifetime);

0 commit comments

Comments
 (0)