This commit is contained in:
@@ -6,6 +6,7 @@ let currentMoviesPage = 1;
|
||||
let currentSeriesPage = 1;
|
||||
let dashboardData = null;
|
||||
let seriesSourcesLoaded = false;
|
||||
let authRetryAttempts = 0;
|
||||
|
||||
// Initialize app
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
@@ -204,7 +205,6 @@ async function loadMovies(page = 1) {
|
||||
const sourceFilter = document.getElementById('movies-filter-source').value;
|
||||
|
||||
const skip = (page - 1) * 100;
|
||||
console.log(`DEBUG: loadMovies called with page=${page}, calculated skip=${skip}`);
|
||||
|
||||
const params = new URLSearchParams({
|
||||
skip: skip,
|
||||
@@ -382,7 +382,6 @@ async function loadSeries(page = 1) {
|
||||
const sourceFilter = document.getElementById('series-filter-source').value;
|
||||
|
||||
const skip = (page - 1) * 50;
|
||||
console.log(`DEBUG: loadSeries called with page=${page}, calculated skip=${skip}`);
|
||||
|
||||
const params = new URLSearchParams({
|
||||
skip: skip,
|
||||
@@ -1361,8 +1360,16 @@ async function checkAuthStatus() {
|
||||
authUsernameSpan.textContent = authStatus.username;
|
||||
authStatusDiv.style.display = 'flex';
|
||||
} else if (authStatus.auth_enabled && !authStatus.authenticated) {
|
||||
// This shouldn't happen if middleware is working, but handle it
|
||||
console.warn('Auth enabled but not authenticated - middleware may be misconfigured');
|
||||
// This can happen briefly during page load - retry once after a short delay
|
||||
if (authRetryAttempts < 1) {
|
||||
authRetryAttempts++;
|
||||
console.debug('Auth enabled but not authenticated - retrying auth check in 500ms');
|
||||
setTimeout(() => {
|
||||
checkAuthStatus();
|
||||
}, 500);
|
||||
} else {
|
||||
console.warn('Auth enabled but not authenticated after retry - middleware may be misconfigured');
|
||||
}
|
||||
} else {
|
||||
// Authentication disabled - hide auth status
|
||||
authStatusDiv.style.display = 'none';
|
||||
|
||||
@@ -387,9 +387,6 @@ class MovieProcessor:
|
||||
|
||||
_log("DEBUG", f"Movie processing reached file mtime section: fix_dir_mtimes={config.fix_dir_mtimes}, dateadded={dateadded}")
|
||||
|
||||
# Yield control briefly during movie processing to allow web interface requests
|
||||
import time
|
||||
time.sleep(0.005) # 5ms yield per movie to improve responsiveness
|
||||
|
||||
# Save to database
|
||||
_log("DEBUG", f"About to save to database: imdb_id={imdb_id}, dateadded={dateadded}")
|
||||
|
||||
@@ -214,11 +214,6 @@ class TVProcessor:
|
||||
_log("ERROR", f"S{season:02d}E{episode:02d}: Database write failed: {e}")
|
||||
# Continue processing other episodes
|
||||
|
||||
# Yield control every 3 episodes to allow other requests (webhooks, web interface)
|
||||
if episode_count % 3 == 0:
|
||||
import time
|
||||
time.sleep(0.1) # 100ms yield to improve responsiveness during episode processing
|
||||
_log("DEBUG", f"Processed {episode_count} episodes, yielding to allow other requests...")
|
||||
|
||||
# Skip season.nfo and tvshow.nfo creation - focus only on episode NFOs
|
||||
pass
|
||||
@@ -453,11 +448,6 @@ class TVProcessor:
|
||||
episode_data['dateAdded'] = import_date
|
||||
_log("DEBUG", f"Got import date from history for S{season:02d}E{episode_num:02d}: {import_date}")
|
||||
|
||||
# Yield control every 5 API calls to allow other requests
|
||||
if api_calls_made % 5 == 0:
|
||||
import time
|
||||
time.sleep(0.01) # 10ms yield to other processes
|
||||
_log("DEBUG", f"Yielded after {api_calls_made} Sonarr API calls to allow other requests...")
|
||||
|
||||
# Fallback to episodeFile.dateAdded if history didn't work
|
||||
if not episode_data['dateAdded'] and episode.get('hasFile'):
|
||||
@@ -468,11 +458,6 @@ class TVProcessor:
|
||||
|
||||
episode_map[(season, episode_num)] = episode_data
|
||||
|
||||
# Also yield control every 20 episodes processed to prevent blocking
|
||||
if episodes_processed % 20 == 0:
|
||||
import time
|
||||
time.sleep(0.01) # 10ms yield for large episode lists
|
||||
_log("DEBUG", f"Processed {episodes_processed} episodes, yielding to allow other requests...")
|
||||
|
||||
if filter_set:
|
||||
_log("DEBUG", f"Made {api_calls_made} Sonarr history API calls for filtered episodes (instead of all episodes)")
|
||||
|
||||
Reference in New Issue
Block a user