Skip to content

Commit

Permalink
rework wikidata and mb delays
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here committed Dec 25, 2024
1 parent b025b67 commit f7d2b40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nowplaying/artistextras/wikimedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 44 in nowplaying/artistextras/wikimedia.py

View check run for this annotation

Codecov / codecov/patch

nowplaying/artistextras/wikimedia.py#L44

Added line #L44 was not covered by tests
page.get()
except Exception as err: # pylint: disable=broad-except
page = None
Expand Down
6 changes: 3 additions & 3 deletions nowplaying/musicbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit f7d2b40

Please sign in to comment.