The action should be placed in the body again before retrying

This commit is contained in:
Fabio Manganiello 2017-11-05 15:16:54 +01:00
parent 83d6fd9817
commit 9e23d0a407

View file

@ -77,7 +77,8 @@ def _exec_func(body, retry=True):
return return
target = body.pop('target') target = body.pop('target')
tokens = body.pop('action').split('.') action = body.pop('action')
tokens action.split('.')
module_name = str.join('.', tokens[:-1]) module_name = str.join('.', tokens[:-1])
method_name = tokens[-1:][0] method_name = tokens[-1:][0]
@ -109,6 +110,9 @@ def _exec_func(body, retry=True):
except Exception as e: except Exception as e:
logging.exception(e) logging.exception(e)
if retry: if retry:
# Put the action back where it was before retrying
body['action'] = action
logging.info('Reloading plugin {} and retrying'.format(module_name)) logging.info('Reloading plugin {} and retrying'.format(module_name))
_init_plugin(module_name, reload=True) _init_plugin(module_name, reload=True)
_exec_func(body, retry=False) _exec_func(body, retry=False)