Skip to content

spool: handle startup backlog and resync after overflow - #5

Merged
0x4D31 merged 1 commit into
mainfrom
adel/fsnotify-fix
Dec 3, 2025
Merged

spool: handle startup backlog and resync after overflow#5
0x4D31 merged 1 commit into
mainfrom
adel/fsnotify-fix

Conversation

@0x4D31

@0x4D31 0x4D31 commented Dec 3, 2025

Copy link
Copy Markdown
Owner
  • seed existing spool files into stability tracking so recent pre-start files are processed
  • avoid blocking on large startup backlogs by enqueueing stably or tracking for later delivery
  • rescan the spool when fsnotify reports ErrEventOverflow to recover missed files
  • add tests for startup-recent files, backlog handling, and overflow resync

Tests: GOCACHE=/tmp/go-build-cache go test ./internal/spool

- seed existing spool files into stability tracking so recent pre-start files are processed
- avoid blocking on large startup backlogs by enqueueing stably or tracking for later delivery
- rescan the spool when fsnotify reports ErrEventOverflow to recover missed files
- add tests for startup-recent files, backlog handling, and overflow resync

Tests: GOCACHE=/tmp/go-build-cache go test ./internal/spool
@0x4D31
0x4D31 merged commit 2ba60d7 into main Dec 3, 2025
6 checks passed
@0x4D31
0x4D31 deleted the adel/fsnotify-fix branch December 3, 2025 21:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/spool/watcher.go
Comment on lines +304 to +307
// Check if we're at max capacity
if len(fileStability) >= w.maxPendingFiles {
log.Printf("Warning: max pending files reached (%d), dropping oldest", w.maxPendingFiles)
// Remove oldest entry

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Startup backlog truncated by maxPendingFiles cap

Because seedExistingFiles now funnels pre-existing spool files through trackFile, this branch will drop the oldest entries once the backlog exceeds maxPendingFiles. If Santa restarts with more files in spool/new than the channel buffer plus maxPendingFiles (e.g., >1100 with defaults) or a resync sees a large overflow backlog, those extra files are removed from tracking and never delivered, whereas the previous implementation would block but eventually process all of them. That silently loses collected events during large startup/overflow backlogs.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant