Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804064
D358.id975.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:05 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:05 AM (4 h, 36 m)
Engine
blob
Format
Raw Data
Handle
576778
Attached To
D358: INP-1753 - Protect against racing condition during Scheduled Tasks execution
D358.id975.diff
View Options
Index: branches/5.2.x/core/kernel/managers/scheduled_task_manager.php
===================================================================
--- branches/5.2.x/core/kernel/managers/scheduled_task_manager.php
+++ branches/5.2.x/core/kernel/managers/scheduled_task_manager.php
@@ -124,6 +124,11 @@
$site_domain_id = $site_helper->getDomainByName('DomainName', DOMAIN);
foreach ($events_source as $short_name => $event_data) {
+ // Scheduled task was updated from another process.
+ if ( $this->getLiveData($short_name) != $event_data ) {
+ continue;
+ }
+
if ( $site_domain_id && $event_data['SiteDomainLimitation'] != '' ) {
$site_domains = explode('|', substr($event_data['SiteDomainLimitation'], 1, -1));
@@ -152,6 +157,22 @@
}
/**
+ * Returns LIVE scheduled task data.
+ *
+ * @param string $short_name Short scheduled task name.
+ *
+ * @return array
+ */
+ protected function getLiveData($short_name)
+ {
+ $sql = 'SELECT *
+ FROM ' . $this->Application->getUnitOption('scheduled-task', 'TableName') . '
+ WHERE Status = ' . STATUS_ACTIVE . ' AND Name = ' . $this->Conn->qstr($short_name);
+
+ return $this->Conn->GetRow($sql);
+ }
+
+ /**
* Runs scheduled task based on given data
*
* @param Array $scheduled_task_data
@@ -220,4 +241,4 @@
'Name = ' . $this->Conn->qstr($scheduled_task_name)
);
}
-}
\ No newline at end of file
+}
Event Timeline
Log In to Comment