Skip to content

Commit ba05893

Browse files
authored
fix: Avoid the python 3.9+ threadpool cleanup bug (feast-dev#4627)
fix: dont allow for new refresh threadpool tasks to start during shutdown Signed-off-by: Rob Howley <howley.robert@gmail.com>
1 parent 945b0fa commit ba05893

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sdk/python/feast/feature_server.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ def stop_refresh():
8585
active_timer.cancel()
8686

8787
def async_refresh():
88+
if shutting_down:
89+
return
90+
8891
store.refresh_registry()
8992
nonlocal registry_proto
9093
registry_proto = store.registry.proto()
91-
if shutting_down:
92-
return
9394

9495
if registry_ttl_sec:
9596
nonlocal active_timer
@@ -222,8 +223,12 @@ def write_to_online_store(body=Depends(get_body)):
222223
)
223224

224225
@app.get("/health")
225-
def health():
226-
return Response(status_code=status.HTTP_200_OK)
226+
async def health():
227+
return (
228+
Response(status_code=status.HTTP_200_OK)
229+
if registry_proto
230+
else Response(status_code=status.HTTP_503_SERVICE_UNAVAILABLE)
231+
)
227232

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

0 commit comments

Comments
 (0)