From f7d2b40bf2dcdd8dfa068251c078b0eb5acc2343 Mon Sep 17 00:00:00 2001 From: Allen Wittenauer Date: Tue, 24 Dec 2024 22:00:58 -0600 Subject: [PATCH] rework wikidata and mb delays --- nowplaying/artistextras/wikimedia.py | 4 ++-- nowplaying/musicbrainz.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nowplaying/artistextras/wikimedia.py b/nowplaying/artistextras/wikimedia.py index 1f5bec628..9195cdf41 100644 --- a/nowplaying/artistextras/wikimedia.py +++ b/nowplaying/artistextras/wikimedia.py @@ -34,14 +34,14 @@ def _check_missing(self, metadata): def _get_page(self, entity, lang): logging.debug("Processing %s", entity) try: - page = wptools.page(wikibase=entity, lang=lang, silent=True) + page = wptools.page(wikibase=entity, lang=lang, silent=True, timeout=5) page.get() except Exception: # pylint: disable=broad-except page = None if self.config.cparser.value('wikimedia/bio_iso_en_fallback', type=bool) and lang != 'en': try: - page = wptools.page(wikibase=entity, lang='en', silent=True) + page = wptools.page(wikibase=entity, lang='en', silent=True, timeout=5) page.get() except Exception as err: # pylint: disable=broad-except page = None diff --git a/nowplaying/musicbrainz.py b/nowplaying/musicbrainz.py index 5c9c7a85b..a93fe1b26 100755 --- a/nowplaying/musicbrainz.py +++ b/nowplaying/musicbrainz.py @@ -19,8 +19,8 @@ REMIX_RE = re.compile(r'^\s*(.*)\s+[\(\[].*[\)\]]$') -musicbrainzngs.musicbrainz._max_retries = 1 # pylint: disable=protected-access -musicbrainzngs.musicbrainz._timeout = 30 # pylint: disable=protected-access +musicbrainzngs.musicbrainz._max_retries = 2 # pylint: disable=protected-access +musicbrainzngs.musicbrainz._timeout = 15 # pylint: disable=protected-access # WNP (typically) has large lulls between 2-3 calls that need to happen # quickly. so double the rate of calls to speed things up but still # keep a rate limiter in case the DJ is doing something stupid @@ -45,7 +45,7 @@ class MusicBrainzHelper(): ''' handler for NowPlaying ''' def __init__(self, config=None): - logging.getLogger('musicbrainzngs').setLevel(logging.CRITICAL + 1) + logging.getLogger('musicbrainzngs').setLevel(logging.INFO) if config: self.config = config else: