Skip to content

Commit

Permalink
Merge pull request #2662 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
dev merge
  • Loading branch information
GuillaumeDSM authored Jul 7, 2024
2 parents ca60e8e + 4081632 commit 730262e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions octobot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ async def _get_authenticated_community_if_possible(config, logger):
if not community_auth.is_initialized():
# try with saved credentials if any
has_tentacles = tentacles_manager_api.is_tentacles_architecture_valid()
# When no tentacles, fetch private data. Otherwise fetch it later on in bot init
await community_auth.async_init_account(fetch_private_data=not has_tentacles)
# When no tentacles or in cloud, fetch private data. Otherwise fetch it later on in bot init
fetch_private_data = not has_tentacles or constants.IS_CLOUD_ENV
await community_auth.async_init_account(fetch_private_data=fetch_private_data)
except authentication.FailedAuthentication as err:
logger.error(f"Failed authentication when initializing community authenticator: {err}")
except Exception as err:
Expand Down
4 changes: 4 additions & 0 deletions octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,15 @@ async def fetch_private_data(self, reset=False):
except Exception as err:
self.logger.exception(err, True, f"Unexpected error when fetching package urls: {err}")
finally:
if self._fetched_private_data is None:
self._fetched_private_data = asyncio.Event()
self._fetched_private_data.set()
if self.has_open_source_package():
# fetch indexes as well
await self._refresh_products()

async def _fetch_package_urls(self, mqtt_uuid: typing.Optional[str]) -> (list[str], str):
self.logger.debug(f"Fetching package")
resp = await self.supabase_client.http_get(
constants.COMMUNITY_EXTENSIONS_CHECK_ENDPOINT,
headers={
Expand All @@ -570,6 +573,7 @@ async def _fetch_package_urls(self, mqtt_uuid: typing.Optional[str]) -> (list[st
params={"mqtt_id": mqtt_uuid} if mqtt_uuid else {},
timeout=constants.COMMUNITY_FETCH_TIMEOUT
)
self.logger.debug("Fetched package")
resp.raise_for_status()
json_resp = json.loads(resp.json().get("message", {}))
if not json_resp:
Expand Down

0 comments on commit 730262e

Please sign in to comment.