Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -177,7 +177,7 @@ def update_db(user_id, conversation_id, message, response):
|
|
177 |
|
178 |
async def clear_inactive_conversations():
|
179 |
while True:
|
180 |
-
|
181 |
current_time = time.time()
|
182 |
inactive_convos = [conv_id for conv_id, last_time in last_activity.items()
|
183 |
if current_time - last_time > 1800] # 30 minutes
|
@@ -186,7 +186,6 @@ async def clear_inactive_conversations():
|
|
186 |
del conversations[conv_id]
|
187 |
if conv_id in last_activity:
|
188 |
del last_activity[conv_id]
|
189 |
-
logger.info(f"Cleared {len(inactive_convos)} inactive conversations")
|
190 |
await asyncio.sleep(60) # Check every minute
|
191 |
|
192 |
@app.on_event("startup")
|
|
|
177 |
|
178 |
async def clear_inactive_conversations():
|
179 |
while True:
|
180 |
+
|
181 |
current_time = time.time()
|
182 |
inactive_convos = [conv_id for conv_id, last_time in last_activity.items()
|
183 |
if current_time - last_time > 1800] # 30 minutes
|
|
|
186 |
del conversations[conv_id]
|
187 |
if conv_id in last_activity:
|
188 |
del last_activity[conv_id]
|
|
|
189 |
await asyncio.sleep(60) # Check every minute
|
190 |
|
191 |
@app.on_event("startup")
|