Skip to content

Commit

Permalink
fix: Avoid the python 3.9+ threadpool cleanup bug (feast-dev#4627)
Browse files Browse the repository at this point in the history
fix: dont allow for new refresh threadpool tasks to start during shutdown

Signed-off-by: Rob Howley <[email protected]>
  • Loading branch information
robhowley authored Oct 14, 2024
1 parent 945b0fa commit ba05893
Showing 1 changed file with 9 additions and 4 deletions.
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

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)
)

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

0 comments on commit ba05893

Please sign in to comment.