Skip to content

Commit 431c011

Browse files
committed
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 3976b7e commit 431c011

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

sdk/python/feast/feature_server.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,12 @@ def stop_refresh():
125125
active_timer.cancel()
126126

127127
def async_refresh():
128+
if shutting_down:
129+
return
130+
128131
store.refresh_registry()
129132
nonlocal registry_proto
130133
registry_proto = store.registry.proto()
131-
if shutting_down:
132-
return
133134

134135
if registry_ttl_sec:
135136
nonlocal active_timer
@@ -244,8 +245,12 @@ def write_to_online_store(body=Depends(get_body)):
244245
)
245246

246247
@app.get("/health")
247-
def health():
248-
return Response(status_code=status.HTTP_200_OK)
248+
async def health():
249+
return (
250+
Response(status_code=status.HTTP_200_OK)
251+
if registry_proto
252+
else Response(status_code=status.HTTP_503_SERVICE_UNAVAILABLE)
253+
)
249254

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

0 commit comments

Comments
 (0)