Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed is not removed when subscribers left #82

Open
stmllr opened this issue Jan 23, 2025 · 0 comments · May be fixed by #83
Open

Feed is not removed when subscribers left #82

stmllr opened this issue Jan 23, 2025 · 0 comments · May be fixed by #83

Comments

@stmllr
Copy link

stmllr commented Jan 23, 2025

Given I subscribed to a feed
When I unsubscribe from the feed
And noone else is subscribed to the feed
Then the feed should not be polled anymore

This looks like a bug to me, since _check_feed() contains logic to remove the feed. However an early return some lines before prevents it from being reached:

def _check_feed(bot: Bot, feed: Feed) -> None:
    d = parse_feed(feed.url, etag=feed.etag, modified=feed.modified)

    if d.entries and feed.latest:
        d.entries = get_new_entries(d.entries, tuple(map(int, feed.latest.split())))
    if not d.entries:
        return
^^^^^^^^^^^^^^^^^^^^^^^^
    full_html = format_entries(d.entries[:100], "")
    with session_scope() as session:
        stmt = select(Fchat).where(Fchat.feed_url == feed.url)
        fchats = session.execute(stmt).scalars().all()
        if not fchats:
            session.delete(feed)
            return
stmllr added a commit to stmllr/feedsbot that referenced this issue Jan 23, 2025
@stmllr stmllr linked a pull request Jan 23, 2025 that will close this issue
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 a pull request may close this issue.

1 participant