mirror of
https://github.com/lifekiller/rarbg.git
synced 2025-05-15 15:00:20 -07:00
use lock for token refresh
This commit is contained in:
parent
9e3ac3d218
commit
7330ee78f4
4
rarbg.py
4
rarbg.py
@ -67,7 +67,8 @@ async def api(params):
|
||||
query_text = pretty(params)
|
||||
secho('[{}] {}'.format(request_id, query_text), fg='cyan')
|
||||
|
||||
await refresh_token()
|
||||
async with app.lock:
|
||||
await refresh_token()
|
||||
|
||||
async with app.lock:
|
||||
params.update(token=app.token, format='json_extended')
|
||||
@ -116,7 +117,6 @@ def main():
|
||||
handler = app.make_handler()
|
||||
f = loop.create_server(handler, '0.0.0.0', 4444)
|
||||
srv = loop.run_until_complete(f)
|
||||
asyncio.ensure_future(refresh_token())
|
||||
secho('serving on {}:{}'.format(*srv.sockets[0].getsockname()), fg='yellow')
|
||||
loop.run_forever()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user