Skip to content
Merged
Changes from 1 commit
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
Next Next commit
fix: Disable active_timer When registry_ttl_sec is 0
Signed-off-by: Jiwon Park <phil.park@sktelecom.com>
  • Loading branch information
j1wonpark committed Sep 9, 2024
commit 5b33eecc23e3365f7d493b049cd094c4d4570bd7
35 changes: 19 additions & 16 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class MaterializeIncrementalRequest(BaseModel):


def get_app(
store: "feast.FeatureStore",
registry_ttl_sec: int = DEFAULT_FEATURE_SERVER_REGISTRY_TTL,
store: "feast.FeatureStore",
registry_ttl_sec: int = DEFAULT_FEATURE_SERVER_REGISTRY_TTL,
):
proto_json.patch()
# Asynchronously refresh registry, notifying shutdown and canceling the active timer if the app is shutting down
Expand All @@ -90,9 +90,11 @@ def async_refresh():
registry_proto = store.registry.proto()
if shutting_down:
return
nonlocal active_timer
active_timer = threading.Timer(registry_ttl_sec, async_refresh)
active_timer.start()

if registry_ttl_sec:
nonlocal active_timer
active_timer = threading.Timer(registry_ttl_sec, async_refresh)
active_timer.start()

@asynccontextmanager
async def lifespan(app: FastAPI):
Expand Down Expand Up @@ -181,9 +183,9 @@ def push(body=Depends(get_body)):
fv
for fv in all_fvs
if (
fv.stream_source is not None
and isinstance(fv.stream_source, PushSource)
and fv.stream_source.name == request.push_source_name
fv.stream_source is not None
and isinstance(fv.stream_source, PushSource)
and fv.stream_source.name == request.push_source_name
)
}

Expand Down Expand Up @@ -269,6 +271,7 @@ async def rest_exception_handler(request: Request, exc: Exception):
if sys.platform != "win32":
import gunicorn.app.base


class FeastServeApplication(gunicorn.app.base.BaseApplication):
def __init__(self, store: "feast.FeatureStore", **options):
self._app = get_app(
Expand Down Expand Up @@ -306,14 +309,14 @@ def monitor_resources(self, interval: int = 5):


def start_server(
store: "feast.FeatureStore",
host: str,
port: int,
no_access_log: bool,
workers: int,
keep_alive_timeout: int,
registry_ttl_sec: int,
metrics: bool,
store: "feast.FeatureStore",
host: str,
port: int,
no_access_log: bool,
workers: int,
keep_alive_timeout: int,
registry_ttl_sec: int,
metrics: bool,
):
if metrics:
logger.info("Starting Prometheus Server")
Expand Down