[rss] Moved _parse_subscriptions call inside of main.

Rather than the plugin constructor.

This is to ensure that the application startup won't be have to wait for
the feed parsing logic to complete.
This commit is contained in:
Fabio Manganiello 2024-10-20 03:24:37 +02:00
parent 897f3a6f47
commit 76b86aec0e
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -59,8 +59,9 @@ class RssPlugin(RunnablePlugin):
self._feed_workers = [] self._feed_workers = []
self._latest_entries = [] self._latest_entries = []
self.subscriptions = list(self._parse_subscriptions(subscriptions or []))
self._latest_timestamps = {} self._latest_timestamps = {}
self._subscriptions = subscriptions
self.subscriptions = []
@staticmethod @staticmethod
def _get_feed_latest_timestamp_varname(url: str) -> str: def _get_feed_latest_timestamp_varname(url: str) -> str:
@ -318,6 +319,7 @@ class RssPlugin(RunnablePlugin):
return ElementTree.tostring(root, encoding='utf-8', method='xml').decode() return ElementTree.tostring(root, encoding='utf-8', method='xml').decode()
def main(self): def main(self):
self.subscriptions = list(self._parse_subscriptions(self._subscriptions or []))
self._latest_timestamps = self._get_latest_timestamps() self._latest_timestamps = self._get_latest_timestamps()
self._feed_workers = [ self._feed_workers = [
threading.Thread(target=self._feed_worker, args=(q,)) threading.Thread(target=self._feed_worker, args=(q,))