Skip to content

feat(rss): add pause, resume and list commands with worker lifecycle management - #56

Merged
danfeldmann merged 3 commits into
mainfrom
feat/rss-pause-and-list
Nov 9, 2026
Merged

danfeldmann merged 3 commits into
mainfrom
feat/rss-pause-and-list

Conversation

@danfeldmann

Copy link
Copy Markdown
Member

Summary

This PR enhances the RSS feed management in GSHBot with pause/resume controls, an overview command, and clean background worker lifecycle management:

1. Pause & Resume (!rss pause / !rss resume, aliases: disable / enable)

  • Adds commands to toggle RSS feed polling without needing to delete and recreate entries.
  • Updates the activeStatus field in simple-json-db and the in-memory feed slice thread-safely.
  • Manages per-feed goroutines via context.Context and gofeed.ParseURLWithContext.
  • Background workers immediately terminate on pause, deletion (!rss del), or server shutdown (rss.StopRSSFeeds()).
  • Workers resume cleanly when enabled.

2. List Command (!rss list)

  • Displays an overview of all configured RSS feeds with name, URL, polling interval, and status.
  • Dynamically resolves Discord channel names (e.g. #news) from channel IDs via the Discord session cache/API.

3. Testing & Hygiene

  • Added comprehensive unit tests in extension/rss/rss_test.go and handler/messagehandler/replycommands_rss_test.go (100% PASS).
  • Formatted with go fmt and checked with go vet.

- Add pause/disable and resume/enable commands to ReplyCommands
- Implement SetFeedActiveStatus, PauseFeed and ResumeFeed
- Manage per-feed background worker goroutines with context.Context and cancellable backoff timer
- Stop running worker immediately when feed is deleted via RemoveFeedFromList
- Gracefully stop all feed workers on server shutdown
- Add unit tests for worker lifecycle, pause/resume and command permissions
- Add GetFeeds helper to read all configured feeds from database
- Implement !rss list command with formatted feed overview
- Dynamically resolve Discord channel name from channel ID via session state and API
- Add unit tests for GetFeeds and the list command
@github-code-quality

github-code-quality Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Go

Go / code-coverage/go-test

main bffc51c feat/rss-pause-and-l... 9fd7ec7 +/-
41% 50% +9%
View coverage of the 2 most impacted files.
File main bffc51c feat/rss-pause-and-l... 9fd7ec7 +/-
extension/rss/rss.go 62% 67% +5%
handler/message...eplycommands.go 21% 49% +28%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 09, 2026 08:41 UTC

…t-of-bounds read

- Add explicit len(parts) < 3 check inside del, pause/disable, and resume/enable
- Remove compound pre-switch condition to resolve CodeQL off-by-one warning
@danfeldmann
danfeldmann merged commit 2ba684d into main Nov 9, 2026
2 checks passed
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