Skip to content

Commit

Permalink
Less verbose missing media logging
Browse files Browse the repository at this point in the history
Instead of logging each item in the backup database that no longer has
an entry in the Plex database, consolidate it to a single line that
reports the total number of items missing.
  • Loading branch information
danrahn committed Jan 15, 2024
1 parent 56ab1c8 commit 94112a5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Server/MarkerBackupManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ ORDER BY id DESC;`;

/** @type {{ [sectionId: number]: number[] }} */
const disconnected = {};
/** @type {Set<number>} */
const noGuid = new Set();
for (const action of actions) {
if (action.op === MarkerOp.Delete) {
continue; // Last action was a user delete, ignore it.
Expand All @@ -997,8 +999,7 @@ ORDER BY id DESC;`;
PlexQueries.getMovieFromGuid(action.parent_guid) :
PlexQueries.getEpisodeFromGuid(action.parent_guid));
if (!fromGuid) {
Log.verbose(`No episode found for marker id ${action.id}, ` +
`but keeping around in case the episode guid is added in the future.`);
noGuid.add(action.id);
continue;
}

Expand All @@ -1012,6 +1013,12 @@ ORDER BY id DESC;`;
}
}

if (noGuid.size > 0) {
Log.verbose(`No episode found for ${noGuid.size} marker ids` +
(noGuid.size < 10 ? ` (${Array.from(noGuid).join(', ')})` : '') +
`, but keeping around in case the episode guid is added in the future.`);
}

// Ignore disconnected markers all at once
for (const [sectionId, markerIds] of Object.entries(disconnected)) {
this.ignorePurgedMarkers(markerIds, parseInt(sectionId));
Expand Down

0 comments on commit 94112a5

Please sign in to comment.