mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Handling when refresh cleanup function has error.
This commit is contained in:
parent
63e8512fb2
commit
14c69f5295
1 changed files with 12 additions and 3 deletions
|
|
@ -836,7 +836,9 @@ async def apply_modelers():
|
|||
try:
|
||||
await modeler()
|
||||
except Exception as e:
|
||||
logger.error(f'Modeler raised error', exc_info=e)
|
||||
logger.error(f'Modeler {modeler.__name__} raised error', exc_info=e)
|
||||
if PYTEST:
|
||||
raise
|
||||
# Sleep to catch cancel.
|
||||
await asyncio.sleep(0)
|
||||
|
||||
|
|
@ -851,8 +853,15 @@ def register_refresh_cleanup(func: callable):
|
|||
|
||||
async def apply_refresh_cleanup():
|
||||
for func in REFRESH_CLEANUP:
|
||||
logger_.info(f'Applying refresh cleanup {func.__name__}')
|
||||
func()
|
||||
try:
|
||||
logger_.info(f'Applying refresh cleanup {func.__name__}')
|
||||
func()
|
||||
except Exception as e:
|
||||
logger.error(f'Refresh cleanup {func.__name__} failed!', exc_info=e)
|
||||
if PYTEST:
|
||||
raise
|
||||
# Sleep to catch cancel.
|
||||
await asyncio.sleep(0)
|
||||
|
||||
|
||||
@iterify(tuple)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue