Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ namespace OpenClawTray.Services;
/// </summary>
public static class NotificationHistoryService
{
private static readonly List<NotificationHistoryItem> _history = new();
private static readonly LinkedList<NotificationHistoryItem> _history = new();
private static readonly object _lock = new();
private const int MaxHistory = 100;

public static void AddNotification(GatewayNotification notification)
{
lock (_lock)
{
_history.Insert(0, new NotificationHistoryItem
_history.AddFirst(new NotificationHistoryItem
{
Timestamp = DateTime.Now,
Title = notification.Title ?? "OpenClaw",
Expand All @@ -29,7 +29,7 @@ public static void AddNotification(GatewayNotification notification)
// Trim to max
while (_history.Count > MaxHistory)
{
_history.RemoveAt(_history.Count - 1);
_history.RemoveLast();
}
}
}
Expand Down