Enhance bot functionality and refactor database interactions
- Added `ca-certificates` installation to Dockerfile for improved network security. - Updated health check command in Dockerfile to include better timeout handling. - Refactored `run_helper.py` to implement proper signal handling and logging during shutdown. - Transitioned database operations to an asynchronous model in `async_db.py`, improving performance and responsiveness. - Updated database schema to support new foreign key relationships and optimized indexing for better query performance. - Enhanced various bot handlers to utilize async database methods, improving overall efficiency and user experience. - Removed obsolete database and fix scripts to streamline the project structure.
This commit is contained in:
@@ -10,24 +10,16 @@ from .services import PostPublishService, BanService
|
||||
def get_post_publish_service() -> PostPublishService:
|
||||
"""Фабрика для PostPublishService"""
|
||||
bdf = get_global_instance()
|
||||
bot = Bot(
|
||||
token=bdf.settings['Telegram']['bot_token'],
|
||||
default=DefaultBotProperties(parse_mode='HTML'),
|
||||
timeout=30.0
|
||||
)
|
||||
|
||||
db = bdf.get_db()
|
||||
settings = bdf.settings
|
||||
return PostPublishService(bot, db, settings)
|
||||
return PostPublishService(None, db, settings)
|
||||
|
||||
|
||||
def get_ban_service() -> BanService:
|
||||
"""Фабрика для BanService"""
|
||||
bdf = get_global_instance()
|
||||
bot = Bot(
|
||||
token=bdf.settings['Telegram']['bot_token'],
|
||||
default=DefaultBotProperties(parse_mode='HTML'),
|
||||
timeout=30.0
|
||||
)
|
||||
|
||||
db = bdf.get_db()
|
||||
settings = bdf.settings
|
||||
return BanService(bot, db, settings)
|
||||
return BanService(None, db, settings)
|
||||
|
||||
Reference in New Issue
Block a user