From b38f03c0e7218762d90fa5092696b127f24f36db Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 25 Jan 2026 07:07:26 +0000
Subject: [PATCH] =Some logical flaws in Queue.php, Queue.js, ContentExecutor.php, UploadExecutor.php - particularly with timeline ordering, frontend queue updates, etc

---
 inc/rest/routes/SettingsRoutes.php |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/inc/rest/routes/SettingsRoutes.php b/inc/rest/routes/SettingsRoutes.php
index f02fad9..ff4faaa 100644
--- a/inc/rest/routes/SettingsRoutes.php
+++ b/inc/rest/routes/SettingsRoutes.php
@@ -3,7 +3,7 @@
 
 use JVBase\JVB;
 use JVBase\rest\RestRouteManager;
-use JVBase\managers\CacheManager;
+use JVBase\managers\Cache;
 use JVBase\meta\MetaManager;
 use JVBase\meta\MetaSanitizer;
 use WP_REST_Request;
@@ -48,10 +48,9 @@
      */
     public function saveSettings(WP_REST_Request $request):WP_REST_Response
     {
-        $this->queue = JVB()->queue();
 
         $data = $request->get_params();
-
+		error_log('User: '.print_r($data['user'], true));
         error_log('Settings routes data: '.print_r($data, true));
         $user_id = (int)$data['user'];
         if (!$this->userCheck($user_id)) {
@@ -62,9 +61,6 @@
         }
 
 
-        $operation_id = $data['id'];
-        unset($data['id']);
-
         $fields = JVB()->getFields('user');
         $meta = new MetaSanitizer();
         $add = [];
@@ -83,8 +79,7 @@
                 //Sanitize values
                 $data[$name] = $meta->sanitize($value, $fields[$name]);
                 if ($name === 'notify') {
-                    $cache = new CacheManager('usernames');
-                    $cache->invalidate($user_id);
+                    Cache::for('usernames')->forget($user_id);
                 }
             }
         }
@@ -92,13 +87,12 @@
             $data['notification_preferences'] = $add;
         }
 
-        $this->queue->queueOperation(
-            $this->type,
+        JVB()->queue()->queueOperation(
+            'user_settings',
             $user_id,
             $data,
             [
                 'count'   => 1,
-                'operation_id'      => $operation_id
             ]
         );
 
@@ -106,7 +100,6 @@
         return new WP_REST_Response([
             'success' =>true,
             'message' => 'Request received and queued',
-            'operation_id' => $operation_id,
             'status' => 'queued'
         ]);
     }
@@ -154,7 +147,7 @@
 				}
 
             }
-            CacheManager::invalidateGroup($this->cache_name);
+            $this->cache->flush();
         }
         return [
             'success'   => true,
@@ -223,7 +216,7 @@
             // Success - commit transaction
             $wpdb->query('COMMIT');
 
-            CacheManager::invalidateGroup($this->cache_name);
+            $this->cache->flush();
             return [
                 'success' => true,
                 'result' => 'Notification preferences updated successfully'

--
Gitblit v1.10.0