gitlab: fix rate limiting check
This commit is contained in:
parent
9937378876
commit
033440da84
|
@ -42,13 +42,16 @@ async def get_version(name, conf, **kwargs):
|
|||
for key in handler_precedence:
|
||||
if key in conf:
|
||||
func = import_module('.source.' + key, __package__).get_version
|
||||
version = await func(name, conf, **kwargs)
|
||||
if version:
|
||||
version = version.replace('\n', ' ')
|
||||
try:
|
||||
version = substitute_version(version, name, conf)
|
||||
except (ValueError, re.error):
|
||||
logger.exception('error occurred in version substitutions', name=name)
|
||||
return version
|
||||
break
|
||||
else:
|
||||
logger.error('no idea to get version info.', name=name)
|
||||
return
|
||||
|
||||
version = await func(name, conf, **kwargs)
|
||||
if version:
|
||||
version = version.replace('\n', ' ')
|
||||
try:
|
||||
version = substitute_version(version, name, conf)
|
||||
except (ValueError, re.error):
|
||||
logger.exception('error occurred in version substitutions', name=name)
|
||||
return version
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# Copyright (c) 2013-2018 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
import os
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
import structlog
|
||||
|
@ -66,7 +65,7 @@ def check_ratelimit(exc, name):
|
|||
raise
|
||||
|
||||
# default -1 is used to re-raise the exception
|
||||
n = int(res.headers.get('RateLimit-Remaining'), -1)
|
||||
n = int(res.headers.get('RateLimit-Remaining', -1))
|
||||
if n == 0:
|
||||
logger.error('rate limited, resetting at (unknown). '
|
||||
'Or get an API token to increase the allowance if not yet',
|
||||
|
|
Loading…
Reference in New Issue