From 235ce5716edc2f7cbe80fdccf26eac7269587839 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 08 Jun 2026 04:38:18 +0000
Subject: [PATCH] =FavouritesManager.php and FavouritesRoutes.php fixes. Moving all logic to FavouritesManager.php. Still some left to do
---
assets/js/concise/Queue.js | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/assets/js/concise/Queue.js b/assets/js/concise/Queue.js
index a2232ca..0290aa9 100644
--- a/assets/js/concise/Queue.js
+++ b/assets/js/concise/Queue.js
@@ -17,6 +17,7 @@
this.items = new Map();
this.subscribers = new Set();
this.loadFromStorage = false;
+ this.failedFetches = 0;
this.api = jvbSettings.api;
this.endpoint = 'queue';
@@ -30,6 +31,7 @@
this.initElements();
this.initListeners();
this.initStore();
+
if (this.canUpdateUI && this.ui.panel) {
this.popup = window.jvbPopup.registerPopup({
popup: this.ui.panel,
@@ -615,18 +617,18 @@
body: requestBody
}
);
- console.log('Sending request with data: ', req);
+ // console.log('Sending request with data: ', req);
const result = await response.json();
if (skip) {
operation.data = {};
}
- console.log('Result: ', result);
+ // console.log('Result: ', result);
if (response.ok && result.success) {
this.notify('sent-to-server', req);
if (result.id && operation.id !== result.id) {
operation = await this.handleServerMerge(operation, result);
} else {
- operation.status = result.status??'failed';
+ operation.status = result.status??'pending';
operation.serverData = result;
this.updateOperationStatus(operation.id, operation.status);
}
@@ -786,7 +788,14 @@
try {
this.ui.refresh.button.classList.add('fetching');
this.store.clearCache();
- await this.store.fetch();
+ let response = await this.store.fetch();
+ if (response.status === 429) {
+ console.log('Too many requests. Waiting 30 seconds');
+ this.stopPolling();
+ this.startCountdown(30, () => this.runPollCycle());
+ return;
+ }
+
this.ui.refresh.button.classList.remove('fetching');
if (!this.maybeStartPolling()) {
this.stopPolling();
@@ -794,6 +803,8 @@
return;
}
} catch (error) {
+ this.stopPolling();
+ this.updatePanel('synced');
console.error('Polling error:', error);
}
--
Gitblit v1.10.0