From 2fd9c0c5a204ee209a0d5a47fe0cefcb44d85aae Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 01:48:23 +0000
Subject: [PATCH] =added helper to CRUD.js to ignore upload field changes if an upload is in progress
---
inc/managers/queue/Storage.php | 41 +++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/inc/managers/queue/Storage.php b/inc/managers/queue/Storage.php
index e565146..add78a5 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 ?: []);
}
@@ -143,6 +138,9 @@
return false;
}
+
+ $this->invalidateUser($op->userId);
+
return true;
}
@@ -177,7 +175,6 @@
];
$updated = $wpdb->update($table, $data, $where);
- $this->invalidateQueueCache();
if ($updated === 0) {
return true;
@@ -187,6 +184,8 @@
error_log('[Storage::saveFinal] DB error: ' . $wpdb->last_error);
return false;
}
+ $this->invalidateQueueCache();
+ $this->invalidateUser($op->userId);
return true;
}
@@ -244,6 +243,8 @@
$type, $userId
));
+ $this->invalidateUser($userId);
+
return $row ? $this->rowToOperation($row) : null;
}
@@ -447,7 +448,7 @@
private function invalidateUser(int $userId): void
{
- $this->cache->forget($userId);
+ Cache::for($userId.'_queue')->flush();
}
public function getLastError(): string
{
--
Gitblit v1.10.0