Skip to content

Commit

Permalink
kill tasks on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jan 5, 2025
1 parent 509b56f commit 39f0a0d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion agixt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@asynccontextmanager
async def lifespan(app: FastAPI):
workspace_manager.start_file_watcher()
threading.Thread(target=task_monitor.start).start()
tasks = threading.Thread(target=task_monitor.start).start()
NGROK_TOKEN = getenv("NGROK_TOKEN")
if NGROK_TOKEN:
from pyngrok import ngrok
Expand All @@ -63,6 +63,8 @@ async def lifespan(app: FastAPI):
# Shutdown
workspace_manager.stop_file_watcher()
task_monitor.stop()
if tasks:
tasks.kill()
if NGROK_TOKEN:
try:
ngrok.kill()
Expand Down

0 comments on commit 39f0a0d

Please sign in to comment.