+6
-20
cmd/brooke-spin/main.go
+6
-20
cmd/brooke-spin/main.go
···
108
108
stateManager *state.Manager,
109
109
currentState *state.State,
110
110
) error {
111
-
// Check if avatar changed externally before processing notifications
112
-
if err := detectAvatarChange(blueskyClient, imageProcessor, stateManager, currentState); err != nil {
113
-
log.Printf("Warning: failed to detect avatar change: %v", err)
114
-
}
115
-
116
-
// Fetch notifications
117
-
log.Printf("Checking for notifications (processed: %d, cursor: %s)",
118
-
len(currentState.ProcessedNotifications), currentState.LastNotificationCursor)
119
-
notifications, newCursor, err := blueskyClient.ListNotifications(currentState.LastNotificationCursor, 50)
111
+
// Fetch notifications - ALWAYS fetch latest page (cursor="") to avoid getting stuck in history
112
+
// We rely on ProcessedNotifications map to filter out already seen ones
113
+
log.Printf("Checking for notifications (processed: %d)", len(currentState.ProcessedNotifications))
114
+
notifications, _, err := blueskyClient.ListNotifications("", 50)
120
115
if err != nil {
121
116
return fmt.Errorf("failed to fetch notifications: %w", err)
122
117
}
123
-
log.Printf("API returned %d total notifications", len(notifications))
124
-
118
+
125
119
// Filter for unprocessed notifications that match configured types
126
120
var relevantNotifications []client.Notification
127
121
var skippedCount int
···
138
132
}
139
133
140
134
if skippedCount > 0 {
141
-
log.Printf("Skipped %d already-processed notifications", skippedCount)
135
+
log.Printf("Found %d total, skipped %d processed notifications", len(notifications), skippedCount)
142
136
}
143
137
144
138
if len(relevantNotifications) == 0 {
145
-
// Update cursor even if no relevant notifications to process
146
-
if newCursor != "" && newCursor != currentState.LastNotificationCursor {
147
-
currentState.LastNotificationCursor = newCursor
148
-
if err := stateManager.Save(currentState); err != nil {
149
-
log.Printf("Warning: failed to save cursor: %v", err)
150
-
}
151
-
}
152
139
return nil
153
140
}
154
141
···
212
199
log.Printf("✓ Processed %d notification(s)! Total rotation: %.2f°", len(relevantNotifications), currentState.CumulativeRotation)
213
200
214
201
// Update state
215
-
currentState.LastNotificationCursor = newCursor
216
202
currentState.LastProcessedAt = time.Now().Format(time.RFC3339)
217
203
218
204
// Normalize cumulative rotation to 0-360 range