File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
infrastructure/pydantic_settings Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ services:
3636
3737 TTT_GEMINI_URL : https://my-openai-gemini-sigma-sandy.vercel.app
3838
39+ TTT_DIALOG_TTL : 259200 # 3 days
40+
3941 TTT_MATCHMAKING_MAX_WORKERS : 4
4042 TTT_MATCHMAKING_WORKER_MAX_USERS : 100
4143 TTT_MATCHMAKING_WORKER_CREATION_INTERVAL_SECONDS : 0.5
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ services:
3636
3737 TTT_GEMINI_URL : ${GEMINI_URL}
3838
39+ TTT_DIALOG_TTL : 259200 # 3 days
40+
3941 TTT_MATCHMAKING_MAX_WORKERS : 4
4042 TTT_MATCHMAKING_WORKER_MAX_USERS : 100
4143 TTT_MATCHMAKING_WORKER_CREATION_INTERVAL_SECONDS : 0.5
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ class Envs(BaseSettings):
2323
2424 gemini_url : str
2525
26+ dialog_ttl : int
27+
2628 matchmaking_max_workers : int
2729 matchmaking_worker_max_users : int
2830 matchmaking_worker_creation_interval_seconds : float
Original file line number Diff line number Diff line change 118118from ttt .application .user .view_other_user import ViewOtherUser
119119from ttt .application .user .view_user import ViewUser
120120from ttt .application .user .view_user_emojis import ViewUserEmojis
121+ from ttt .infrastructure .pydantic_settings .envs import Envs
121122from ttt .infrastructure .pydantic_settings .secrets import Secrets
122123from ttt .presentation .adapters .emojis import PictographsAsEmojis
123124from ttt .presentation .adapters .game_views import (
@@ -163,8 +164,13 @@ class PresentationProvider(Provider):
163164 provide_event = from_context (TelegramObject | None , scope = Scope .REQUEST )
164165
165166 @provide (scope = Scope .APP )
166- def provide_strage (self , redis : Redis ) -> BaseStorage :
167- return RedisStorage (redis , DefaultKeyBuilder (with_destiny = True ))
167+ def provide_strage (self , redis : Redis , envs : Envs ) -> BaseStorage :
168+ return RedisStorage (
169+ redis ,
170+ DefaultKeyBuilder (with_destiny = True ),
171+ state_ttl = envs .dialog_ttl ,
172+ data_ttl = envs .dialog_ttl ,
173+ )
168174
169175 @provide (scope = Scope .APP )
170176 def provide_bg_manager_factory (self , dp : Dispatcher ) -> BgManagerFactory :
You can’t perform that action at this time.
0 commit comments