🐛 fix(cache/factory.py): change variable name from settings_service to settings_manager for consistency and clarity

🐛 fix(cache/factory.py): change variable name from settings_service to settings_manager for consistency and clarity
🐛 fix(database/factory.py): change variable name from settings_service to settings_manager for consistency and clarity
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-17 17:23:31 -03:00
commit c49e660e80
3 changed files with 11 additions and 11 deletions

View file

@ -7,17 +7,17 @@ class CacheManagerFactory(ServiceFactory):
def __init__(self):
super().__init__(BaseCacheManager)
def create(self, settings_service):
def create(self, settings_manager):
# Here you would have logic to create and configure a CacheManager
# based on the settings_service
if settings_service.settings.CACHE_TYPE == "redis":
if settings_manager.settings.CACHE_TYPE == "redis":
logger.debug("Creating Redis cache")
redis_cache = RedisCache(
host=settings_service.settings.REDIS_HOST,
port=settings_service.settings.REDIS_PORT,
db=settings_service.settings.REDIS_DB,
expiration_time=settings_service.settings.REDIS_CACHE_EXPIRE,
host=settings_manager.settings.REDIS_HOST,
port=settings_manager.settings.REDIS_PORT,
db=settings_manager.settings.REDIS_DB,
expiration_time=settings_manager.settings.REDIS_CACHE_EXPIRE,
)
if redis_cache.is_connected():
logger.debug("Redis cache is connected")
@ -27,5 +27,5 @@ class CacheManagerFactory(ServiceFactory):
)
return InMemoryCache()
elif settings_service.settings.CACHE_TYPE == "memory":
elif settings_manager.settings.CACHE_TYPE == "memory":
return InMemoryCache()

View file

@ -6,6 +6,6 @@ class ChatManagerFactory(ServiceFactory):
def __init__(self):
super().__init__(ChatManager)
def create(self, settings_service):
def create(self):
# Here you would have logic to create and configure a ChatManager
return ChatManager()

View file

@ -10,8 +10,8 @@ class DatabaseManagerFactory(ServiceFactory):
def __init__(self):
super().__init__(DatabaseManager)
def create(self, settings_service: "SettingsManager"):
def create(self, settings_manager: "SettingsManager"):
# Here you would have logic to create and configure a DatabaseManager
if not settings_service.settings.DATABASE_URL:
if not settings_manager.settings.DATABASE_URL:
raise ValueError("No database URL provided")
return DatabaseManager(settings_service.settings.DATABASE_URL)
return DatabaseManager(settings_manager.settings.DATABASE_URL)