From 0dfe1d8afafc59c4a5559c498342668d5a58d6ef Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 23 Jul 2026 22:41:41 +0000
Subject: [PATCH] =Still working away at the Integrations overhaul

---
 inc/managers/queue/Queue.php |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/inc/managers/queue/Queue.php b/inc/managers/queue/Queue.php
index 89a8ceb..aee981e 100644
--- a/inc/managers/queue/Queue.php
+++ b/inc/managers/queue/Queue.php
@@ -343,7 +343,7 @@
 		// Use provided operation_id or generate one
 		$op->id = !empty($options['operation_id'])
 			? $options['operation_id']
-			: 'u' . $userId . '_' . uniqid('op_');
+			: self::generateID($userId);
 
 		$op->type = $type;
 		$op->userId = $userId;
@@ -404,7 +404,7 @@
 
 	private function runQueueOnShutdown(): void
 	{
-		if (!has_action('shutdown', [$this, 'processQueueOnShutdown'])) {
+		if (!has_action('shutdown', [$this, 'processQueueOnShutdown']) && $this->processor->hasAdequateResources()) {
 			add_action('shutdown', [$this, 'processQueueOnShutdown'], 100);
 		}
 	}
@@ -463,4 +463,9 @@
 				return $response;
 		}
 	}
+
+	public static function generateId(int $userID):string
+	{
+		return 'u' . $userID . '_' . uniqid('op_');
+	}
 }

--
Gitblit v1.10.0