From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan

---
 inc/managers/queue/Storage.php |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/inc/managers/queue/Storage.php b/inc/managers/queue/Storage.php
index e565146..99cd8c3 100644
--- a/inc/managers/queue/Storage.php
+++ b/inc/managers/queue/Storage.php
@@ -34,24 +34,19 @@
 	{
 		$now = current_time('mysql');
 
-		$rows = $this->wpdb->get_results($this->wpdb->prepare("
-			SELECT oq.* FROM {$this->table} oq
-			WHERE oq.state IN ('pending', 'scheduled')
-			  AND oq.scheduled_at <= %s
-			  AND NOT EXISTS (
-				  SELECT 1
-				  FROM JSON_TABLE(
-					  COALESCE(NULLIF(oq.dependencies, 'null'), '[]'),
-					  '\$[*]' COLUMNS (dep_id VARCHAR(64) PATH '\$')
-				  ) AS deps
-				  JOIN {$this->table} dep ON dep.id = deps.dep_id
-				  WHERE dep.state != 'completed'
-					 OR dep.outcome NOT IN ('success', 'partial')
-			  )
-			ORDER BY FIELD(oq.priority, 'high', 'normal', 'low'), oq.scheduled_at
-			LIMIT %d
-			FOR UPDATE SKIP LOCKED
-		", $now, $limit));
+		$rows = $this->wpdb->get_results(
+			$this->wpdb->prepare("
+            SELECT *
+            FROM {$this->table}
+            WHERE state IN ('pending', 'scheduled')
+              AND scheduled_at <= %s
+            ORDER BY
+              FIELD(priority, 'high', 'normal', 'low'),
+              scheduled_at
+            LIMIT %d
+            FOR UPDATE SKIP LOCKED
+        ", $now, $limit)
+		);
 
 		return array_map([$this, 'rowToOperation'], $rows ?: []);
 	}

--
Gitblit v1.10.0