Skip to content

Commit

Permalink
fix creating new state when using dependency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
SawyerCzupka committed Nov 5, 2024
1 parent 06f4c10 commit 8582ba1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions k8s-autoscaler/k8s_autoscaler/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# app/dependencies.py
from fastapi import Depends
from fastapi import Depends, Request
from .config import Settings
from .types import AutoscalerState
from .kubernetes import KubeCommand
Expand All @@ -10,8 +10,8 @@ def get_settings() -> Settings:
return Settings()


def get_state() -> AutoscalerState:
return AutoscalerState()
def get_state(request: Request) -> AutoscalerState:
return request.app.state.state


def get_kube(settings: Settings = Depends(get_settings)) -> KubeCommand:
Expand Down

0 comments on commit 8582ba1

Please sign in to comment.