aa
This commit is contained in:
parent
ca4e5a568b
commit
d3bfc203b5
16
main.py
16
main.py
@ -93,17 +93,17 @@ class MyBot(commands.Bot):
|
|||||||
)
|
)
|
||||||
log.info("Redis client initialized and attached to bot.redis.")
|
log.info("Redis client initialized and attached to bot.redis.")
|
||||||
|
|
||||||
# Pass the initialized pools to the settings_manager
|
# Make sure the bot instance is set in the global_bot_accessor
|
||||||
if self.pg_pool and self.redis:
|
# This ensures settings_manager can access the pools via get_bot_instance()
|
||||||
settings_manager.set_bot_pools(self.pg_pool, self.redis)
|
set_bot_instance(self)
|
||||||
log.info("Bot's pg_pool and redis_client passed to settings_manager.")
|
log.info("Bot instance set in global_bot_accessor from setup_hook.")
|
||||||
|
|
||||||
# Initialize database schema and run migrations using settings_manager
|
# Initialize database schema and run migrations using settings_manager
|
||||||
# These functions will now use the pools provided by the bot.
|
if self.pg_pool and self.redis:
|
||||||
try:
|
try:
|
||||||
await settings_manager.initialize_database() # Uses the pool set via set_bot_pools
|
await settings_manager.initialize_database() # Uses the bot instance via get_bot_instance()
|
||||||
log.info("Database schema initialization called via settings_manager.")
|
log.info("Database schema initialization called via settings_manager.")
|
||||||
await settings_manager.run_migrations() # Uses the pool set via set_bot_pools
|
await settings_manager.run_migrations() # Uses the bot instance via get_bot_instance()
|
||||||
log.info("Database migrations called via settings_manager.")
|
log.info("Database migrations called via settings_manager.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception("CRITICAL: Failed during settings_manager database setup (init/migrations).")
|
log.exception("CRITICAL: Failed during settings_manager database setup (init/migrations).")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user