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

fix: Avoid the python 3.9+ threadpool cleanup bug #4627

Merged
merged 1 commit into from
Oct 14, 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
13 changes: 9 additions & 4 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ def stop_refresh():
active_timer.cancel()

def async_refresh():
if shutting_down:
return

store.refresh_registry()
nonlocal registry_proto
registry_proto = store.registry.proto()
if shutting_down:
return
Comment on lines +88 to -92
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we're shutting down, no need to run refresh


if registry_ttl_sec:
nonlocal active_timer
Expand Down Expand Up @@ -222,8 +223,12 @@ def write_to_online_store(body=Depends(get_body)):
)

@app.get("/health")
def health():
return Response(status_code=status.HTTP_200_OK)
async def health():
return (
Response(status_code=status.HTTP_200_OK)
if registry_proto
else Response(status_code=status.HTTP_503_SERVICE_UNAVAILABLE)
)
Comment on lines +226 to +231
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if a path operation can be async in fastapi, it should be. update it to reflect that without a registry, the service is unavailable.


@app.post("/materialize", dependencies=[Depends(inject_user_details)])
def materialize(body=Depends(get_body)):
Expand Down
Loading