Skip to content

Bundle what the fetching needs in a Fetcher - #174

Open
Namisabot wants to merge 1 commit into
mainfrom
claude/elegant-euler-q5gvyf
Open

Namisabot wants to merge 1 commit into
mainfrom
claude/elegant-euler-q5gvyf

Conversation

@Namisabot

Copy link
Copy Markdown
Collaborator

What

Point 2 of the review for maintainability, after #171.

round, fetch_one and run in fetch.rs each took the same six to eight things: the database, the hardened client, RSSifier, the cleaning rules, the events, the monitor and what is under way.

  • Two of them needed an exception from clippy's too_many_arguments.
  • Every spawn cloned them one by one.
  • A new dependency of the fetching meant three signatures and every caller.

How

  • fetch::Fetcher holds the database, the client, RSSifier, the rules, the events and the monitor. It is cheap to copy, as each part is shared.
  • run, round, fetch_one and fetch_due are its methods. round takes the pace and what is under way, and fetch_one takes the feed. fetch_feed, which fetches one feed on its own for subscribing and the tests, keeps its signature.
  • Fetcher::new gives the tests one without RSSifier and with events and counts of its own. A test that checks the counts or the events sets its own with ..Fetcher::new(…).
  • main.rs, bench fetch and the tests build a Fetcher instead of passing everything along.

Both too_many_arguments exceptions in fetch.rs are gone. The diff adds 209 lines and removes 270.

Nothing the fetching does changes.

Checks

server/:

No query, type or route of the API changed.


Generated by Claude Code

From the review for maintainability. round, fetch_one and run took the
same six to eight things each (the database, the client, RSSifier, the
rules, the events, the monitor, what is under way), two of them with an
exception from clippy's too_many_arguments, and each spawn cloned them one
by one. fetch::Fetcher holds them and is cheap to copy; run, round,
fetch_one and fetch_due are its methods, and Fetcher::new gives the tests
one without RSSifier and with events and counts of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xidw9MHUJTuNTd11rpVAqX
@codecov-commenter

codecov-commenter commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.65421% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/src/fetch.rs 88.76% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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.

3 participants