announcements: remove warnings on failure
Its possible for users to have an unstable internet connection. Log connection errors rather than warn. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
cd03b91f87
commit
64b6029559
|
@ -332,7 +332,6 @@ class RssFeed:
|
||||||
self.moon_db = database.wrap_namespace("moonraker")
|
self.moon_db = database.wrap_namespace("moonraker")
|
||||||
self.xml_file = f"{self.name}.xml"
|
self.xml_file = f"{self.name}.xml"
|
||||||
self.asset_url = f"{MOONLIGHT_URL}/assets/{self.xml_file}"
|
self.asset_url = f"{MOONLIGHT_URL}/assets/{self.xml_file}"
|
||||||
self.warned: bool = False
|
|
||||||
self.last_modified: int = 0
|
self.last_modified: int = 0
|
||||||
self.etag: Optional[str] = None
|
self.etag: Optional[str] = None
|
||||||
self.dev_xml_path: Optional[pathlib.Path] = None
|
self.dev_xml_path: Optional[pathlib.Path] = None
|
||||||
|
@ -364,11 +363,9 @@ class RssFeed:
|
||||||
self.asset_url, headers, enable_cache=False
|
self.asset_url, headers, enable_cache=False
|
||||||
)
|
)
|
||||||
if resp.has_error():
|
if resp.has_error():
|
||||||
msg = f"Failed to update subscription '{self.name}': {resp.error}"
|
logging.info(
|
||||||
logging.info(msg)
|
f"Failed to update subscription '{self.name}': {resp.error}"
|
||||||
if not self.warned:
|
)
|
||||||
self.warned = True
|
|
||||||
self.server.add_warning(msg)
|
|
||||||
return ""
|
return ""
|
||||||
if resp.status_code == 304:
|
if resp.status_code == 304:
|
||||||
logging.debug(f"Content at {self.xml_file} not modified")
|
logging.debug(f"Content at {self.xml_file} not modified")
|
||||||
|
@ -385,10 +382,7 @@ class RssFeed:
|
||||||
if self.dev_xml_path is None:
|
if self.dev_xml_path is None:
|
||||||
return ""
|
return ""
|
||||||
if not self.dev_xml_path.is_file():
|
if not self.dev_xml_path.is_file():
|
||||||
msg = f"No file at path {self.dev_xml_path}"
|
logging.info(f"No file at path {self.dev_xml_path}")
|
||||||
if not self.warned:
|
|
||||||
self.warned = True
|
|
||||||
self.server.add_warning(msg)
|
|
||||||
return ""
|
return ""
|
||||||
mtime = self.dev_xml_path.stat().st_mtime_ns
|
mtime = self.dev_xml_path.stat().st_mtime_ns
|
||||||
if mtime <= self.last_modified:
|
if mtime <= self.last_modified:
|
||||||
|
@ -399,10 +393,7 @@ class RssFeed:
|
||||||
xml_data = await eventloop.run_in_thread(
|
xml_data = await eventloop.run_in_thread(
|
||||||
self.dev_xml_path.read_text)
|
self.dev_xml_path.read_text)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = f"Unable read xml file {self.dev_xml_path}"
|
logging.exception(f"Unable read xml file {self.dev_xml_path}")
|
||||||
if not self.warned:
|
|
||||||
self.warned = True
|
|
||||||
self.server.add_warning(msg)
|
|
||||||
return ""
|
return ""
|
||||||
self.last_modified = mtime
|
self.last_modified = mtime
|
||||||
return xml_data
|
return xml_data
|
||||||
|
|
Loading…
Reference in New Issue