fix: claude hat bugs im Kopf
All checks were successful
Create Release PR / Create Release PR (push) Successful in 10s
All checks were successful
Create Release PR / Create Release PR (push) Successful in 10s
This commit is contained in:
@@ -254,7 +254,12 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("Processing {Count} pending notifications", pendingNotifications.Count);
|
||||
_logger.LogInformation(
|
||||
"Processing {Count} pending notifications (delay={Delay}min, grouping={Grouping}min, cutoff={Cutoff})",
|
||||
pendingNotifications.Count,
|
||||
delayMinutes,
|
||||
groupingWindowMinutes,
|
||||
cutoff);
|
||||
|
||||
// Group episodes by series
|
||||
var episodesBySeries = pendingNotifications
|
||||
@@ -262,6 +267,17 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
.GroupBy(n => n.SeriesId!)
|
||||
.ToList();
|
||||
|
||||
// Log unmatched notifications (neither episode with series nor movie)
|
||||
var unmatchedCount = pendingNotifications.Count
|
||||
- pendingNotifications.Count(n => n.ItemType == "Episode" && !string.IsNullOrEmpty(n.SeriesId))
|
||||
- pendingNotifications.Count(n => n.ItemType == "Movie");
|
||||
if (unmatchedCount > 0)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"{Count} notifications are neither episodes (with SeriesId) nor movies and will be skipped",
|
||||
unmatchedCount);
|
||||
}
|
||||
|
||||
// Process each series group
|
||||
foreach (var seriesGroup in episodesBySeries)
|
||||
{
|
||||
@@ -271,19 +287,34 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
// Only process if the oldest notification is outside the grouping window
|
||||
if (oldestInGroup > groupingCutoff)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"Waiting for grouping window for series {SeriesId}, oldest: {Oldest}",
|
||||
_logger.LogInformation(
|
||||
"Waiting for grouping window for series {SeriesName} ({SeriesId}), oldest queued: {Oldest}, grouping cutoff: {Cutoff}",
|
||||
seriesGroup.First().SeriesName,
|
||||
seriesGroup.Key,
|
||||
oldestInGroup);
|
||||
oldestInGroup,
|
||||
groupingCutoff);
|
||||
continue;
|
||||
}
|
||||
|
||||
await _discordService.SendGroupedEpisodeNotificationAsync(
|
||||
_logger.LogInformation(
|
||||
"Sending grouped notification for {SeriesName}: {Count} episodes",
|
||||
seriesGroup.First().SeriesName,
|
||||
seriesGroup.Count());
|
||||
|
||||
var success = await _discordService.SendGroupedEpisodeNotificationAsync(
|
||||
seriesGroup,
|
||||
CancellationToken.None);
|
||||
|
||||
var idsToRemove = seriesGroup.Select(n => n.Id).ToList();
|
||||
_historyService.RemoveNotifications(idsToRemove);
|
||||
if (success)
|
||||
{
|
||||
var idsToRemove = seriesGroup.Select(n => n.Id).ToList();
|
||||
_historyService.RemoveNotifications(idsToRemove);
|
||||
_logger.LogInformation("Removed {Count} processed episode notifications from queue", idsToRemove.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Discord send failed for {SeriesName}, keeping notifications in queue for retry", seriesGroup.First().SeriesName);
|
||||
}
|
||||
}
|
||||
|
||||
// Process movies
|
||||
@@ -293,8 +324,19 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
|
||||
foreach (var movie in movies)
|
||||
{
|
||||
await _discordService.SendMovieNotificationAsync(movie, CancellationToken.None);
|
||||
_historyService.RemoveNotifications(new[] { movie.Id });
|
||||
_logger.LogInformation("Sending movie notification for: {Name}", movie.Name);
|
||||
|
||||
var success = await _discordService.SendMovieNotificationAsync(movie, CancellationToken.None);
|
||||
|
||||
if (success)
|
||||
{
|
||||
_historyService.RemoveNotifications(new[] { movie.Id });
|
||||
_logger.LogInformation("Removed processed movie notification from queue: {Name}", movie.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Discord send failed for movie {Name}, keeping in queue for retry", movie.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user