gitlab: fix rate limiting check
This commit is contained in:
parent
9937378876
commit
033440da84
|
@ -42,6 +42,11 @@ async def get_version(name, conf, **kwargs):
|
|||
for key in handler_precedence:
|
||||
if key in conf:
|
||||
func = import_module('.source.' + key, __package__).get_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', ' ')
|
||||
|
@ -50,5 +55,3 @@ async def get_version(name, conf, **kwargs):
|
|||
except (ValueError, re.error):
|
||||
logger.exception('error occurred in version substitutions', name=name)
|
||||
return version
|
||||
else:
|
||||
logger.error('no idea to get version info.', name=name)
|
||||
|
|
|
@ -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