Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions bot/roundupFirstSeen.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { PersistentMap } from "../utils/persistentMap.js";

// Wider than the 7-day roundup window so an item filtered out one week is
// still remembered the following week (avoids it re-appearing as "new" if
// Sonarr does a second upgrade just past the 7-day mark).
const TTL_MS = 14 * 24 * 60 * 60 * 1000;
// Items already seen should never re-appear as "new" regardless of how many
// Sonarr/Radarr quality upgrades happen. ~5 years is effectively permanent.
const TTL_MS = 5 * 365 * 24 * 60 * 60 * 1000;

const map = new PersistentMap("roundup-first-seen", TTL_MS, {
validateValue: (v) => v && typeof v.firstSeenAt === "number",
Expand Down
4 changes: 2 additions & 2 deletions jellyfinWebhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const debouncedSenders = new Map();
// re-notifies anything in the recently-added window via the next poll/WS reconnect).
const sentNotifications = new PersistentMap(
"sent-notifications",
7 * 24 * 60 * 60 * 1000, // 7 dayssurvive Sonarr/Radarr upgrade cycles
5 * 365 * 24 * 60 * 60 * 1000, // ~5 yearsitems already in the library never re-notify
{ validateValue: (v) => v && typeof v.level === "number" }
);

Expand Down Expand Up @@ -1003,7 +1003,7 @@ export async function handleJellyfinWebhook(req, res, client, pendingRequests, o
`[DUPLICATE CHECK] ${data.ItemType} "${
data.Name
}" - SeriesId: ${SeriesId}, sentLevel: ${sentLevel}, currentLevel: ${currentLevel}, has debouncer: ${debouncedSenders.has(
SeriesId
seriesKey
)}`
);

Expand Down
Loading