From a0563db7d44dfd7e43733f2c1033e87706b445a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Reuh=20Fildadut?= Date: Mon, 13 Oct 2025 14:32:35 +0200 Subject: [PATCH] feat: only connect to server when necessary in sync-up --- src/feather/feather.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/feather/feather.py b/src/feather/feather.py index 7859e63..d7249d5 100755 --- a/src/feather/feather.py +++ b/src/feather/feather.py @@ -19,6 +19,9 @@ class FeatherApp: if not self._client_session: config = self.config api = config.server_api + print( + f"Connecting to {config.server_user}@{config.server_url} ({api} API)..." + ) if api == "googlereader": self._client_session = GReaderSession(config) elif api == "ttrss": @@ -57,7 +60,6 @@ class FeatherApp: def toggle_read_flag_for_deleted(self): """Mark articles that are in the JSON directory but with missing HTML file as read/unread on the server""" config = self.config - client_session = self.get_client_session() # gather articles to mark as read/unread marked_as_read, marked_as_unread = 0, 0 @@ -72,7 +74,11 @@ class FeatherApp: to_mark_as_unread.append(article) marked_as_unread += 1 + if len(to_mark_as_read) == len(to_mark_as_unread) == 0: + return # nothing to do + # change read state on server + client_session = self.get_client_session() to_mark_as_read_id = [article.id for article in to_mark_as_read] for i in range(0, len(to_mark_as_read_id), config.articles_per_query): client_session.set_read_flag( @@ -102,7 +108,7 @@ class FeatherApp: config = self.config client_session = self.get_client_session() - print("Synchronizing with server...") + print("Synchronizing from server...") new_articles, updated_articles = 0, 0 grabbed_article_paths: set[ArticleId] = set()