From 8dffd445a86848a69c14bf47743f2d6c3cc540ef Mon Sep 17 00:00:00 2001 From: cardosofede Date: Wed, 28 Aug 2024 23:10:21 -0300 Subject: [PATCH 1/2] (feat) improve manage accounts --- routers/manage_accounts.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/routers/manage_accounts.py b/routers/manage_accounts.py index e8991a0..91b634e 100644 --- a/routers/manage_accounts.py +++ b/routers/manage_accounts.py @@ -1,6 +1,5 @@ from typing import Dict, List -from apscheduler.schedulers.asyncio import AsyncIOScheduler from fastapi import APIRouter, HTTPException from hummingbot.client.settings import AllConnectorSettings from starlette import status @@ -8,8 +7,6 @@ from services.accounts_service import AccountsService from utils.file_system import FileSystemUtil -# Initialize the scheduler -scheduler = AsyncIOScheduler() router = APIRouter(tags=["Manage Credentials"]) file_system = FileSystemUtil(base_path="bots/credentials") accounts_service = AccountsService() @@ -17,17 +14,9 @@ @router.on_event("startup") async def startup_event(): - # Add the job to the scheduler - scheduler.start() accounts_service.start_update_account_state_loop() -@router.on_event("shutdown") -async def shutdown_event(): - # Shutdown the scheduler on application exit - scheduler.shutdown() - - @router.get("/accounts-state", response_model=Dict[str, Dict[str, List[Dict]]]) async def get_all_accounts_state(): return accounts_service.get_accounts_state() From fde7431df95ff5187e7b282478c66cf714bf8726 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Wed, 28 Aug 2024 23:10:38 -0300 Subject: [PATCH 2/2] (feat) remove start call --- routers/manage_broker_messages.py | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/manage_broker_messages.py b/routers/manage_broker_messages.py index 1498264..8116184 100644 --- a/routers/manage_broker_messages.py +++ b/routers/manage_broker_messages.py @@ -20,7 +20,6 @@ def update_active_bots(): async def startup_event(): # Add the job to the scheduler scheduler.add_job(update_active_bots, 'interval', seconds=10) - scheduler.start() @router.on_event("shutdown")