diff --git a/allianceauth/eveonline/providers.py b/allianceauth/eveonline/providers.py index dcb92c44..201db860 100644 --- a/allianceauth/eveonline/providers.py +++ b/allianceauth/eveonline/providers.py @@ -181,6 +181,25 @@ class EveSwaggerProvider(EveProvider): self.adapter = adapter or self self._faction_list = None # what are the odds this will change? could cache forever! + if settings.DEBUG or StartupCommand().is_management_command: + self._client = None + logger.info('ESI client will be loaded on-demand') + else: + logger.info('Loading ESI client') + try: + self._client = esi_client_factory( + token=self._token, + ua_appname=__title__, + ua_version=__version__, + ua_url=__url__, + ) + except (HTTPError, RefResolutionError): + logger.exception( + 'Failed to load ESI client on startup. ' + 'Switching to on-demand loading for ESI client.' + ) + self._client = None + @property def client(self) -> SwaggerClient: if self._client is None: