mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
higher retry threshold + better logging
This commit is contained in:
parent
395573ca5b
commit
3050bb0703
@ -885,4 +885,4 @@ if DEBUG or TESTING:
|
|||||||
# Plugin test settings
|
# Plugin test settings
|
||||||
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested?
|
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # are plugins beeing tested?
|
||||||
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing?
|
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugins from setup hooks in testing?
|
||||||
PLUGIN_RETRY = get_setting('PLUGIN_RETRY', 5 if not TESTING else 1) # how often should plugin loading be tried?
|
PLUGIN_RETRY = get_setting('PLUGIN_RETRY', 5) # how often should plugin loading be tried?
|
||||||
|
@ -77,7 +77,7 @@ class Plugins:
|
|||||||
logger.info('Database not accessible while loading plugins')
|
logger.info('Database not accessible while loading plugins')
|
||||||
break
|
break
|
||||||
except IntegrationPluginError as error:
|
except IntegrationPluginError as error:
|
||||||
logger.error(f'Encountered an error with {error.path}:\n{error.message}')
|
logger.error(f'[PLUGIN] Encountered an error with {error.path}:\n{error.message}')
|
||||||
log_plugin_error({error.path: error.message}, 'load')
|
log_plugin_error({error.path: error.message}, 'load')
|
||||||
blocked_plugin = error.path # we will not try to load this app again
|
blocked_plugin = error.path # we will not try to load this app again
|
||||||
|
|
||||||
@ -90,8 +90,11 @@ class Plugins:
|
|||||||
retry_counter -= 1
|
retry_counter -= 1
|
||||||
if retry_counter <= 0:
|
if retry_counter <= 0:
|
||||||
if settings.PLUGIN_TESTING:
|
if settings.PLUGIN_TESTING:
|
||||||
print('Max retries, breaking loading')
|
print('[PLUGIN] Max retries, breaking loading')
|
||||||
|
# TODO error for server status
|
||||||
break
|
break
|
||||||
|
if settings.PLUGIN_TESTING:
|
||||||
|
print(f'[PLUGIN] Above error occured during testing - {retry_counter}/{settings.PLUGIN_RETRY} retries left')
|
||||||
|
|
||||||
# now the loading will re-start up with init
|
# now the loading will re-start up with init
|
||||||
|
|
||||||
@ -190,11 +193,9 @@ class Plugins:
|
|||||||
# option1: package, option2: file-based
|
# option1: package, option2: file-based
|
||||||
if (plugin.__name__ == disabled) or (plugin.__module__ == disabled):
|
if (plugin.__name__ == disabled) or (plugin.__module__ == disabled):
|
||||||
# errors are bad so disable the plugin in the database
|
# errors are bad so disable the plugin in the database
|
||||||
# but only if not in testing mode as that breaks in the GH pipeline
|
plugin_db_setting.active = False
|
||||||
if not settings.PLUGIN_TESTING:
|
# TODO save the error to the plugin
|
||||||
plugin_db_setting.active = False
|
plugin_db_setting.save(no_reload=True)
|
||||||
# TODO save the error to the plugin
|
|
||||||
plugin_db_setting.save(no_reload=True)
|
|
||||||
|
|
||||||
# add to inactive plugins so it shows up in the ui
|
# add to inactive plugins so it shows up in the ui
|
||||||
self.plugins_inactive[plug_key] = plugin_db_setting
|
self.plugins_inactive[plug_key] = plugin_db_setting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user