refactored the admin.css
This commit is contained in:
@@ -103,7 +103,7 @@ class ClientCacheManager {
|
||||
* Start periodic version checking
|
||||
*/
|
||||
startVersionChecking() {
|
||||
// Check every 30 seconds
|
||||
// Check every 60 seconds (reduced from 30 to ease rate limiting)
|
||||
this.versionCheckInterval = setInterval(async () => {
|
||||
try {
|
||||
if (await this.hasVersionChanged()) {
|
||||
@@ -111,8 +111,23 @@ class ClientCacheManager {
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Version check failed:', error);
|
||||
// If we get a rate limit error, slow down checks
|
||||
if (error.message?.includes('429') || error.message?.includes('Too Many Requests')) {
|
||||
console.log('Slowing down version checks due to rate limiting');
|
||||
clearInterval(this.versionCheckInterval);
|
||||
// Restart with a longer interval (2 minutes)
|
||||
this.versionCheckInterval = setInterval(async () => {
|
||||
try {
|
||||
if (await this.hasVersionChanged()) {
|
||||
this.handleVersionChange();
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Version check failed:', error);
|
||||
}
|
||||
}, 120000); // 2 minutes
|
||||
}
|
||||
}
|
||||
}, 30000);
|
||||
}, 60000); // 1 minute
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,14 +70,42 @@ function setupAutoRefresh() {
|
||||
// Use longer interval for temp users to avoid rate limiting
|
||||
const refreshInterval_ms = currentUser?.userType === 'temp' ?
|
||||
120000 : // 2 minutes for temp users
|
||||
CONFIG.REFRESH_INTERVAL; // 30 seconds for regular users
|
||||
60000; // 1 minute for regular users (increased from 30 seconds)
|
||||
|
||||
refreshInterval = setInterval(() => {
|
||||
loadLocations();
|
||||
let consecutiveErrors = 0;
|
||||
const maxErrors = 3;
|
||||
|
||||
refreshInterval = setInterval(async () => {
|
||||
try {
|
||||
await loadLocations();
|
||||
consecutiveErrors = 0; // Reset error count on success
|
||||
} catch (error) {
|
||||
consecutiveErrors++;
|
||||
console.warn(`Location refresh failed (${consecutiveErrors}/${maxErrors}):`, error);
|
||||
|
||||
// If we've had too many consecutive errors, slow down the refresh
|
||||
if (consecutiveErrors >= maxErrors) {
|
||||
console.log('Too many consecutive errors, slowing down refresh interval');
|
||||
clearInterval(refreshInterval);
|
||||
|
||||
// Restart with a longer interval
|
||||
const slowInterval = refreshInterval_ms * 2; // Double the interval
|
||||
refreshInterval = setInterval(async () => {
|
||||
try {
|
||||
await loadLocations();
|
||||
consecutiveErrors = 0;
|
||||
} catch (error) {
|
||||
console.warn('Location refresh failed:', error);
|
||||
}
|
||||
}, slowInterval);
|
||||
}
|
||||
}
|
||||
}, refreshInterval_ms);
|
||||
|
||||
if (currentUser?.userType === 'temp') {
|
||||
console.log('Auto-refresh set to 2 minutes for temporary account');
|
||||
} else {
|
||||
console.log('Auto-refresh set to 1 minute for regular account');
|
||||
}
|
||||
}).catch(error => {
|
||||
// Fallback to default interval if auth module fails to load
|
||||
|
||||
Reference in New Issue
Block a user