forked from LBRYCommunity/lbry-sdk
looping_call shouldnt need to mess with cancellation
This commit is contained in:
parent
d22a2dee33
commit
6ae4e68d1c
1 changed files with 6 additions and 10 deletions
|
@ -51,16 +51,12 @@ async def open_file_for_writing(download_directory: str, suggested_file_name: st
|
||||||
|
|
||||||
|
|
||||||
async def looping_call(interval, fun):
|
async def looping_call(interval, fun):
|
||||||
try:
|
while True:
|
||||||
while True:
|
try:
|
||||||
try:
|
await fun()
|
||||||
await fun()
|
except Exception as e:
|
||||||
except Exception as e:
|
log.exception('Looping call experienced exception:', exc_info=e)
|
||||||
log.exception('Looping call experienced exception:', exc_info=e)
|
await asyncio.sleep(interval)
|
||||||
await asyncio.sleep(interval)
|
|
||||||
except asyncio.CancelledError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SQLiteStorage(SQLiteMixin):
|
class SQLiteStorage(SQLiteMixin):
|
||||||
|
|
Loading…
Reference in a new issue