diff --git a/src/reader/_storage.py b/src/reader/_storage.py index 8854d92b..5cdaee5a 100644 --- a/src/reader/_storage.py +++ b/src/reader/_storage.py @@ -703,10 +703,11 @@ def set_feed_updates_enabled(self, url: str, enabled: bool) -> None: rowcount_exactly_one(cursor, lambda: FeedNotFoundError(url)) @wrap_exceptions(StorageError) - def mark_as_stale(self, url: str) -> None: + def set_feed_stale(self, url: str, stale: bool) -> None: with self.get_db() as db: cursor = db.execute( - "UPDATE feeds SET stale = 1 WHERE url = :url;", dict(url=url) + "UPDATE feeds SET stale = :stale WHERE url = :url;", + dict(url=url, stale=stale), ) rowcount_exactly_one(cursor, lambda: FeedNotFoundError(url)) diff --git a/src/reader/_types.py b/src/reader/_types.py index e9a497d0..db3157ed 100644 --- a/src/reader/_types.py +++ b/src/reader/_types.py @@ -269,7 +269,7 @@ class FeedForUpdate(NamedTuple): http_last_modified: str | None #: Whether the next update should update *all* entries, - #: regardless of their .updated. + #: regardless of their :attr:`hash` or :attr:`updated`. stale: bool #: The date the feed was last updated, according to reader; none if never. @@ -675,12 +675,11 @@ class StorageType(Protocol): # pragma: no cover Update methods: * get_feeds_for_update - * get_entries_for_update * update_feed + * set_feed_stale + * get_entries_for_update * add_or_update_entries * is this a good name? - * mark_as_stale - * only used in tests, remove? if not, rename * get_entry_recent_sort * set_entry_recent_sort @@ -742,7 +741,7 @@ def set_feed_user_title(self, url: str, title: str | None) -> None: def set_feed_updates_enabled(self, url: str, enabled: bool) -> None: ... - def mark_as_stale(self, url: str) -> None: + def set_feed_stale(self, url: str, stale: bool) -> None: ... def set_entry_read( diff --git a/tests/test_reader.py b/tests/test_reader.py index 7f3755ae..8fb2a1a2 100644 --- a/tests/test_reader.py +++ b/tests/test_reader.py @@ -1988,7 +1988,7 @@ def test_change_feed_url_feeds_for_update(reader): reader._parser.condition = lambda url: url == '1' reader.update_feeds() - reader._storage.mark_as_stale('1') + reader._storage.set_feed_stale('1', True) def get_feed(feed): return next( diff --git a/tests/test_reader_private.py b/tests/test_reader_private.py index d528e830..f6fba5cb 100644 --- a/tests/test_reader_private.py +++ b/tests/test_reader_private.py @@ -37,7 +37,7 @@ def test_update_stale(reader, update_feed, entry_updated): entry = parser.entry(1, 1, entry_updated) with pytest.raises(FeedNotFoundError): - reader._storage.mark_as_stale(feed.url) + reader._storage.set_feed_stale(feed.url, True) reader.add_feed(feed.url) @@ -73,7 +73,7 @@ def test_update_stale(reader, update_feed, entry_updated): # but it does if we mark the feed as stale parser.calls[:] = [] - reader._storage.mark_as_stale(feed.url) + reader._storage.set_feed_stale(feed.url, True) reader._now = lambda: naive_datetime(2010, 1, 3) update_feed(reader, feed.url) assert parser.calls == [(feed.url, None, None)] diff --git a/tests/test_storage.py b/tests/test_storage.py index 999c7166..e1abf0ee 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -196,8 +196,8 @@ def set_feed_updates_enabled(storage, feed, __): storage.set_feed_updates_enabled(feed.url, 1) -def mark_as_stale(storage, feed, __): - storage.mark_as_stale(feed.url) +def set_feed_stale(storage, feed, __): + storage.set_feed_stale(feed.url, True) def set_entry_read(storage, feed, entry): @@ -314,7 +314,7 @@ def get_entry_last(storage, feed, entry): get_entries_for_update, set_feed_user_title, set_feed_updates_enabled, - mark_as_stale, + set_feed_stale, set_entry_read, set_entry_important, get_entry_recent_sort,