From fb741e5c3e06ff90f3490b978ff9716805ca00e6 Mon Sep 17 00:00:00 2001 From: Jon Taylor Date: Thu, 16 May 2024 19:41:17 +0100 Subject: [PATCH] moved expiry time to create_room --- examples/simple-chatbot/bot_runner.py | 4 ++-- examples/simple-chatbot/daily_helpers.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/simple-chatbot/bot_runner.py b/examples/simple-chatbot/bot_runner.py index df968e67d..5c9e83b24 100644 --- a/examples/simple-chatbot/bot_runner.py +++ b/examples/simple-chatbot/bot_runner.py @@ -29,7 +29,7 @@ atexit.register(cleanup) # ------------ Configuration ------------ # -MAX_SESSION_TIME = 5 * 1000 +MAX_SESSION_TIME = + 5 * 60 # 5 minutes BOT_CAN_IDLE = True SERVE_STATIC = True STATIC_DIR = "../web-ui/dist" @@ -87,7 +87,7 @@ async def start_bot(request: Request) -> JSONResponse: if not room_url: try: - room_url = create_room() + room_url = create_room(MAX_SESSION_TIME) except Exception: raise HTTPException( status_code=500, diff --git a/examples/simple-chatbot/daily_helpers.py b/examples/simple-chatbot/daily_helpers.py index d7c9da8c6..ff50fb91f 100644 --- a/examples/simple-chatbot/daily_helpers.py +++ b/examples/simple-chatbot/daily_helpers.py @@ -14,7 +14,7 @@ daily_api_path = os.getenv("DAILY_API_URL", "api.daily.co/v1") daily_api_key = os.getenv("DAILY_API_KEY") -def create_room() -> tuple[str, str]: +def create_room(expiry_time=5 * 60) -> tuple[str, str]: """ Helper function to create a Daily room. # See: https://docs.daily.co/reference/rest-api/rooms @@ -26,7 +26,7 @@ def create_room() -> tuple[str, str]: Exception: If the request to create the room fails or if the response does not contain the room URL or room name. """ room_props = { - "exp": time.time() + 60 * 60, # 1 hour + "exp": time.time() * expiry_time, "enable_chat": True, "enable_emoji_reactions": True, "eject_at_room_exp": True,