Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/helm_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "elimoshkovich"
Expand All @@ -30,4 +30,4 @@ jobs:
env:
CR_TOKEN: "${{ secrets.PAGES }}"
with:
skip_existing: true
skip_existing: true
9 changes: 4 additions & 5 deletions horizon/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ async def update_state(self) -> AsyncGenerator[PersistentState, None]:
prev_state = self._state
try:
async with self._write_lock:
await asyncio.gather(*self._tasks)
new_state = self._state.copy()
yield new_state
try:
Expand Down Expand Up @@ -196,13 +195,15 @@ def build_state_payload_sync(cls) -> dict:
return payload

async def _report(self, state: PersistentState | None = None):
if state is not None:
self._state = state.copy()
config_url = f"{sidecar_config.CONTROL_PLANE}{sidecar_config.REMOTE_STATE_ENDPOINT}"
async with aiohttp.ClientSession() as session:
logger.info("Reporting status update to server...")
response = await session.post(
url=config_url,
headers={"Authorization": f"Bearer {self._env_api_key}"},
json=await PersistentStateHandler.build_state_payload(state),
json=await PersistentStateHandler.build_state_payload(),
)
if response.status != status.HTTP_204_NO_CONTENT:
logger.warning(
Expand All @@ -213,9 +214,7 @@ async def _report(self, state: PersistentState | None = None):

async def seen_sdk(self, sdk: str):
if sdk not in self._state.seen_sdks:
# ensure_future is expensive, only call it if actually needed
async with self._write_lock:
self._tasks.append(asyncio.create_task(self._report_seen_sdk(sdk)))
await self._report_seen_sdk(sdk)

async def _report_seen_sdk(self, sdk: str):
async with self._seen_sdk_update_lock:
Expand Down
Loading