debug(sse): Add detailed logging for download matching
Add debug logging to trace: - When downloads payload is built - Data sizes from cache (SAB, qBit, Sonarr, Radarr) - Number of downloads found and their titles This will help diagnose why Dora downloads aren't appearing.
This commit is contained in:
@@ -912,6 +912,8 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
await pollAllServices();
|
await pollAllServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`[SSE] Building downloads for ${user.name} (showAll=${showAll})`);
|
||||||
|
|
||||||
const sabQueueData = cache.get('poll:sab-queue') || { slots: [] };
|
const sabQueueData = cache.get('poll:sab-queue') || { slots: [] };
|
||||||
const sabHistoryData = cache.get('poll:sab-history') || { slots: [] };
|
const sabHistoryData = cache.get('poll:sab-history') || { slots: [] };
|
||||||
const sonarrTagsResults = cache.get('poll:sonarr-tags') || [];
|
const sonarrTagsResults = cache.get('poll:sonarr-tags') || [];
|
||||||
@@ -922,6 +924,10 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
const radarrTagsData = cache.get('poll:radarr-tags') || [];
|
const radarrTagsData = cache.get('poll:radarr-tags') || [];
|
||||||
const qbittorrentTorrents = cache.get('poll:qbittorrent') || [];
|
const qbittorrentTorrents = cache.get('poll:qbittorrent') || [];
|
||||||
|
|
||||||
|
console.log(`[SSE] Data sizes - SAB queue: ${sabQueueData.slots?.length || 0}, SAB history: ${sabHistoryData.slots?.length || 0}, qBit: ${qbittorrentTorrents.length}`);
|
||||||
|
console.log(`[SSE] Sonarr queue: ${sonarrQueueData.records?.length || 0}, history: ${sonarrHistoryData.records?.length || 0}`);
|
||||||
|
console.log(`[SSE] Radarr queue: ${radarrQueueData.records?.length || 0}, history: ${radarrHistoryData.records?.length || 0}`);
|
||||||
|
|
||||||
const sabnzbdQueue = { data: { queue: sabQueueData } };
|
const sabnzbdQueue = { data: { queue: sabQueueData } };
|
||||||
const sabnzbdHistory = { data: { history: sabHistoryData } };
|
const sabnzbdHistory = { data: { history: sabHistoryData } };
|
||||||
const sonarrQueue = { data: sonarrQueueData };
|
const sonarrQueue = { data: sonarrQueueData };
|
||||||
@@ -1127,6 +1133,10 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write SSE event
|
// Write SSE event
|
||||||
|
console.log(`[SSE] Sending ${userDownloads.length} downloads for ${user.name}`);
|
||||||
|
if (userDownloads.length > 0) {
|
||||||
|
console.log(`[SSE] Download titles: ${userDownloads.map(d => d.title).join(', ')}`);
|
||||||
|
}
|
||||||
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads })}\n\n`);
|
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads })}\n\n`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[SSE] Error building payload:', sanitizeError(err));
|
console.error('[SSE] Error building payload:', sanitizeError(err));
|
||||||
|
|||||||
Reference in New Issue
Block a user