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/Processor.php |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/inc/managers/queue/Processor.php b/inc/managers/queue/Processor.php
index d743f77..a3eac9d 100644
--- a/inc/managers/queue/Processor.php
+++ b/inc/managers/queue/Processor.php
@@ -21,12 +21,13 @@
 
 		$ops = $this->storage->fetchRunnable(3);
 
-		$lastOpId = null;
 		foreach ($ops as $op) {
+			if (!$this->dependenciesSatisfied($op)) {
+				continue;
+			}
 			if (!$this->storage->markProcessing($op->id)) {
 				continue;
 			}
-			$lastOpId = $op->id;
 			$this->processOne($op);
 			usleep(10000);
 		}
@@ -329,4 +330,31 @@
 
 		return true;
 	}
+
+	private function dependenciesSatisfied(Operation $op): bool
+	{
+		if (empty($op->dependencies)) {
+			return true;
+		}
+
+		foreach ($op->dependencies as $depId) {
+			$dep = $this->storage->find($depId);
+
+			// Missing dependency = block (or decide to ignore; your call)
+			if (!$dep) {
+				return false;
+			}
+
+			if ($dep->state !== 'completed') {
+				return false;
+			}
+
+			if (!in_array($dep->outcome, ['success', 'partial'], true)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
 }

--
Gitblit v1.10.0