Commit 683d0d39 authored by voleger's avatar voleger
Browse files

Issue #3131868 by voleger: Release 2.0.0

parent f22d58e9
......@@ -28,7 +28,7 @@ REQUIREMENTS
------------
This module requires no modules outside of Drupal core.
Supported version of the Drupal core.
A supported version of the Drupal core.
INSTALLATION
......@@ -58,7 +58,7 @@ order:
UI
--
This module provide functionality without any admin UI. It should be
This module provides functionality without any admin UI. It should be
useful on production. Use [Queue UI](https://www.drupal.org/project/queue_ui)
for development needs.
......
name: "Queue Order"
name: Queue Order
type: module
description: "Provide basic functionality to control queue order execution"
description: Provide basic functionality to control queue order execution
package: Queues
core: 8.x
core_version_requirement: ^8 || ^9
......@@ -17,7 +17,7 @@ function queue_order_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This is the module that provide functionality of sorting queue workers definitions. That causes an effect on queue execution order during cron run.') . '</p>';
$output .= '<h3>' . t('Configuration') . '</h3>';
$output .= '<p>' . t('Weight value of queue worker can be defined in the "cron.weight" property of the queue worker definition.') . '</p>';
$output .= '<p>' . t('Weight value of queue worker can be defined in the "weight" property of the queue worker definition.') . '</p>';
$output .= '<p>' . t('All defined queue workers have default weight value that equal to "0".') . '</p>';
$output .= '<p>' . t('To override default queue worker weight property value use "order" property of "queue_order.settings" config object.') . '</p>';
$output .= '<p>' . t('All overridden weight values of queue workers stored in "order" property of "queue_order.settings" config object.') . '</p>';
......
......@@ -60,19 +60,10 @@ class QueueWorkerManager extends CoreQueueWorkerManager {
*/
public static function sortDefinitions(array $definitions, array $weights) {
// Prepare definitions for sorting.
foreach ($definitions as $key => &$definition) {
$weight = 0;
foreach ($definitions as $key => $definition) {
// Define default weight value or hint defined weight to the int value.
if (!empty($definition['cron']['weight'])) {
$weight = intval($definition['cron']['weight']);
}
if (!empty($definition['weight'])) {
$weight = intval($definition['weight']);
}
// Check weight value overrides.
$definition['weight'] = isset($weights[$key]) ?
intval($weights[$key]) :
$weight;
// And check weight value overrides.
$definitions[$key]['weight'] = (int) ($weights[$key] ?? ($definition['weight'] ?? 0));
}
// Sort definitions by weight element.
uasort($definitions, [SortArray::class, 'sortByWeightElement']);
......
......@@ -2,6 +2,6 @@ name: Queue Order Definitions Test
type: module
description: 'Provides testing definitions for Queue Order module'
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9.0
core_version_requirement: ^8 || ^9
......@@ -10,7 +10,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
* @QueueWorker(
* id="queue_order_worker_A",
* title="Test worker with '2' position",
* cron={"time" = 60, "weight" = -40,}
* weight=-40,
* cron={"time" = 60}
* )
*/
class WorkerA extends WorkerBase {}
......@@ -10,7 +10,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
* @QueueWorker(
* id="queue_order_worker_C",
* title="Test worker with '5' position",
* cron={"time" = 60, "weight" = -10,}
* weight=-10,
* cron={"time" = 60}
* )
*/
class WorkerC extends WorkerBase {}
......@@ -10,7 +10,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
* @QueueWorker(
* id="queue_order_worker_D",
* title="Test worker with '3' position",
* cron={"time" = 60, "weight" = -30,}
* weight=-30,
* cron={"time" = 60}
* )
*/
class WorkerD extends WorkerBase {}
......@@ -10,7 +10,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
* @QueueWorker(
* id="queue_order_worker_E",
* title="Test worker with '4' position",
* cron={"time" = 60, "weight" = -20,}
* weight=-20,
* cron={"time" = 60}
* )
*/
class WorkerE extends WorkerBase {}
......@@ -10,7 +10,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
* @QueueWorker(
* id="queue_order_worker_F",
* title="Test worker with 'last' position",
* cron={"time" = 60, "weight" = 10,}
* weight = 10,
* cron={"time" = 60}
* )
*/
class WorkerF extends WorkerBase {}
......@@ -2,7 +2,6 @@ name: Queue Order Definitions Test
type: module
description: 'Provides testing definitions for Queue Order module'
package: Testing
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- queue_order:queue_order_definition_fixtures
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment