database not ready events are hard to reproduce consistently

This commit is contained in:
Matthias 2022-02-13 17:39:17 +01:00
parent 9d12a7172c
commit ad41957127
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ def schedule_task(taskname, **kwargs):
func=taskname, func=taskname,
**kwargs **kwargs
) )
except (OperationalError, ProgrammingError): except (OperationalError, ProgrammingError): # pragma: no cover
# Required if the DB is not ready yet # Required if the DB is not ready yet
pass pass
@ -111,7 +111,7 @@ def offload_task(taskname, *args, force_sync=False, **kwargs):
except AppRegistryNotReady: # pragma: no cover except AppRegistryNotReady: # pragma: no cover
logger.warning(f"Could not offload task '{taskname}' - app registry not ready") logger.warning(f"Could not offload task '{taskname}' - app registry not ready")
return return
except (OperationalError, ProgrammingError): except (OperationalError, ProgrammingError): # pragma: no cover
logger.warning(f"Could not offload task '{taskname}' - database not ready") logger.warning(f"Could not offload task '{taskname}' - database not ready")

View File

@ -40,6 +40,6 @@ class PartConfig(AppConfig):
item.part.trackable = True item.part.trackable = True
item.part.clean() item.part.clean()
item.part.save() item.part.save()
except (OperationalError, ProgrammingError): except (OperationalError, ProgrammingError): # pragma: no cover
# Exception if the database has not been migrated yet # Exception if the database has not been migrated yet
pass pass

View File

@ -51,7 +51,7 @@ class SettingsMixin:
try: try:
plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name()) plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name())
except (OperationalError, ProgrammingError): except (OperationalError, ProgrammingError): # pragma: no cover
plugin = None plugin = None
if not plugin: if not plugin:

View File

@ -102,7 +102,7 @@ class PluginsRegistry:
self._init_plugins(blocked_plugin) self._init_plugins(blocked_plugin)
self._activate_plugins() self._activate_plugins()
registered_successful = True registered_successful = True
except (OperationalError, ProgrammingError): except (OperationalError, ProgrammingError): # pragma: no cover
# Exception if the database has not been migrated yet # Exception if the database has not been migrated yet
logger.info('Database not accessible while loading plugins') logger.info('Database not accessible while loading plugins')
break break