Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev merge #2662

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading