Skip to content

fix(async): correct heartbeat path in AsyncFastAPI#6883

Open
peteroyce wants to merge 1 commit intochroma-core:mainfrom
peteroyce:fix/async-heartbeat-path
Open

fix(async): correct heartbeat path in AsyncFastAPI#6883
peteroyce wants to merge 1 commit intochroma-core:mainfrom
peteroyce:fix/async-heartbeat-path

Conversation

@peteroyce
Copy link
Copy Markdown

Summary

AsyncFastAPI.heartbeat() was calling _make_request("get", "") — an empty path — causing the method to hit the base API URL instead of /heartbeat.

The sync FastAPI.heartbeat() correctly uses /heartbeat. This made the async health-check method fail even when the server was fully healthy.

Root Cause

# Before (broken)
async def heartbeat(self) -> int:
    response = await self._make_request("get", "")  # hits base URL
    return int(response["nanosecond heartbeat"])

# After (fixed)
async def heartbeat(self) -> int:
    response = await self._make_request("get", "/heartbeat")
    return int(response["nanosecond heartbeat"])

Changes

  • chromadb/api/async_fastapi.py: change empty string path to "/heartbeat" to match the sync implementation

Closes #6870

AsyncFastAPI.heartbeat() was calling _make_request with an empty path "",
causing it to hit the base API URL instead of /heartbeat. The sync
FastAPI.heartbeat() correctly uses "/heartbeat". This fixes the async
health-check method failing even when the server is healthy.

Closes chroma-core#6870
@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Copy Markdown
Contributor

Fix AsyncFastAPI.heartbeat() endpoint path

This PR fixes a bug in chromadb/api/async_fastapi.py where AsyncFastAPI.heartbeat() called _make_request("get", "") with an empty path, causing requests to target the base API URL instead of the heartbeat endpoint. The method now correctly calls _make_request("get", "/heartbeat"), aligning async behavior with the sync implementation.

The change is minimal and localized (1-line replacement), and is intended to resolve failed async health checks even when the server is healthy (as described in issue #6870).

This summary was automatically generated by @propel-code-bot

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review found no issues; the heartbeat path fix is correct, minimal, and aligns async behavior with sync routing.

Status: No Issues Found | Risk: Low

Review Details

📁 1 files reviewed | 💬 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Async HTTP client heartbeat calls the API root instead of /heartbeat

1 participant