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

dan/per-10323-opal-statistics-api-errors #622

Merged
merged 1 commit into from
Jul 16, 2024
Merged
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
8 changes: 4 additions & 4 deletions packages/opal-server/opal_server/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ async def _expire_old_servers(self):
now = datetime.utcnow()
still_alive = {}
for server_id, last_seen in self._seen_servers.items():
if (
now - last_seen
).total_seconds() < opal_server_config.STATISTICS_SERVER_KEEPALIVE_TIMEOUT:
if (now - last_seen).total_seconds() < float(
opal_server_config.STATISTICS_SERVER_KEEPALIVE_TIMEOUT
):
still_alive[server_id] = last_seen
self._seen_servers = still_alive
self._state.servers = {self._worker_id} | set(self._seen_servers.keys())
Expand All @@ -140,7 +140,7 @@ async def _periodic_server_keepalive(self):
ServerKeepalive(worker_id=self._worker_id).dict(),
)
await asyncio.sleep(
opal_server_config.STATISTICS_SERVER_KEEPALIVE_TIMEOUT / 2
float(opal_server_config.STATISTICS_SERVER_KEEPALIVE_TIMEOUT) / 2
)
except asyncio.CancelledError:
logger.debug("Statistics: periodic server keepalive cancelled")
Expand Down
Loading