Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
+10
-1
@@ -29,7 +29,15 @@ class _Task extends \IPS\Patterns\ActiveRecord
|
||||
*/
|
||||
public static function runQueue()
|
||||
{
|
||||
$queueData = \IPS\Db::i()->select( '*', 'core_queue', array( 'app_enabled=?', 1 ), 'priority ASC, RAND()', 1, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->join( 'core_applications', "app=app_directory" )->first();
|
||||
/* Get all enabled applications */
|
||||
$enabledApps = array();
|
||||
foreach( \IPS\Application::enabledApplications() as $app )
|
||||
{
|
||||
$enabledApps[] = $app->directory;
|
||||
}
|
||||
|
||||
/* @note SELECT_FROM_WRITE_SERVER: Avoid race conditions with the task locking/finishing */
|
||||
$queueData = \IPS\Db::i()->select( '*', 'core_queue', array( \IPS\Db::i()->in('app', $enabledApps ) ), 'priority ASC, RAND()', 1, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
|
||||
$newOffset = 0;
|
||||
|
||||
$queueData['_originalOffset'] = $queueData['offset'];
|
||||
@@ -199,6 +207,7 @@ class _Task extends \IPS\Patterns\ActiveRecord
|
||||
public static function queued()
|
||||
{
|
||||
$fifteenMinutesAgo = ( time() - 900 );
|
||||
/* @note SELECT_FROM_WRITE_SERVER: Avoid race conditions with the task locking/finishing */
|
||||
foreach ( \IPS\Db::i()->select( '*', 'core_tasks', array( 'next_run<? AND enabled=1', ( time() + 60 ) ), 'next_run ASC', NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER ) as $task )
|
||||
{
|
||||
try
|
||||
|
||||
Reference in new issue
Block a user