Fixed technician config loading
Some checks reported warnings
Deploy dev on push / on-push-deploy_sh-edraft (push) Has been cancelled
Some checks reported warnings
Deploy dev on push / on-push-deploy_sh-edraft (push) Has been cancelled
This commit is contained in:
parent
99d476df86
commit
054490f5ac
@ -1 +1 @@
|
|||||||
Subproject commit 95a4530ae594f3be66e36e2b1af9b86452d9fc3e
|
Subproject commit 4ccf9fb5db7a22948b9fef1dfadcf1aa2d928637
|
@ -7,6 +7,7 @@ from bot_data.abc.technician_config_repository_abc import TechnicianConfigReposi
|
|||||||
from bot_data.model.server import Server
|
from bot_data.model.server import Server
|
||||||
from bot_data.model.technician_config import TechnicianConfig
|
from bot_data.model.technician_config import TechnicianConfig
|
||||||
from bot_data.service.server_config_seeder import ServerConfigSeeder
|
from bot_data.service.server_config_seeder import ServerConfigSeeder
|
||||||
|
from bot_data.service.technician_config_seeder import TechnicianConfigSeeder
|
||||||
|
|
||||||
|
|
||||||
class ConfigService:
|
class ConfigService:
|
||||||
@ -16,17 +17,24 @@ class ConfigService:
|
|||||||
services: ServiceProviderABC,
|
services: ServiceProviderABC,
|
||||||
technician_config_repo: TechnicianConfigRepositoryABC,
|
technician_config_repo: TechnicianConfigRepositoryABC,
|
||||||
server_config_repo: ServerConfigRepositoryABC,
|
server_config_repo: ServerConfigRepositoryABC,
|
||||||
|
technician_seeder: TechnicianConfigSeeder,
|
||||||
server_seeder: ServerConfigSeeder,
|
server_seeder: ServerConfigSeeder,
|
||||||
):
|
):
|
||||||
self._config = config
|
self._config = config
|
||||||
self._services = services
|
self._services = services
|
||||||
self._technician_config_repo = technician_config_repo
|
self._technician_config_repo = technician_config_repo
|
||||||
|
self._technician_seeder = technician_seeder
|
||||||
self._server_config_repo = server_config_repo
|
self._server_config_repo = server_config_repo
|
||||||
|
|
||||||
self._server_seeder = server_seeder
|
self._server_seeder = server_seeder
|
||||||
|
|
||||||
def reload_technician_config(self):
|
async def reload_technician_config(self):
|
||||||
|
try:
|
||||||
technician_config = self._technician_config_repo.get_technician_config()
|
technician_config = self._technician_config_repo.get_technician_config()
|
||||||
|
except Exception as e:
|
||||||
|
await self._technician_seeder.seed()
|
||||||
|
technician_config = self._technician_config_repo.get_technician_config()
|
||||||
|
|
||||||
self._config.add_configuration(TechnicianConfig, technician_config)
|
self._config.add_configuration(TechnicianConfig, technician_config)
|
||||||
self._config.add_configuration(
|
self._config.add_configuration(
|
||||||
FeatureFlagsSettings,
|
FeatureFlagsSettings,
|
||||||
|
@ -91,7 +91,7 @@ class TechnicianConfigMutation(QueryABC):
|
|||||||
self._update_technician_ids(technician_config)
|
self._update_technician_ids(technician_config)
|
||||||
|
|
||||||
self._db.save_changes()
|
self._db.save_changes()
|
||||||
self._config_service.reload_technician_config()
|
self._bot.loop.create_task(self._config_service.reload_technician_config())
|
||||||
return technician_config
|
return technician_config
|
||||||
|
|
||||||
def _update_ping_urls(self, new_config: TechnicianConfig):
|
def _update_ping_urls(self, new_config: TechnicianConfig):
|
||||||
|
@ -19,4 +19,4 @@ class ConfigExtension(ApplicationExtensionABC):
|
|||||||
logger: LoggerABC = services.get_service(LoggerABC)
|
logger: LoggerABC = services.get_service(LoggerABC)
|
||||||
logger.debug(__name__, "Config extension started")
|
logger.debug(__name__, "Config extension started")
|
||||||
config: ConfigService = services.get_service(ConfigService)
|
config: ConfigService = services.get_service(ConfigService)
|
||||||
config.reload_technician_config()
|
await config.reload_technician_config()
|
||||||
|
Loading…
Reference in New Issue
Block a user