gateway/modules/features/featuresLifecycle.py
2025-11-03 00:14:02 +01:00

39 lines
1.1 KiB
Python

import logging
from modules.interfaces.interfaceDbAppObjects import getRootInterface
logger = logging.getLogger(__name__)
async def start() -> None:
""" Start feature triggers and background managers """
rootInterface = getRootInterface()
eventUser = rootInterface.getUserByUsername("event")
# Feature SyncDelta
from modules.features.syncDelta import mainSyncDelta
mainSyncDelta.startSyncManager(eventUser)
# Feature Automation Events
if eventUser:
try:
from modules.interfaces.interfaceDbChatObjects import getInterface as getChatInterface
chatInterface = getChatInterface(eventUser)
if hasattr(chatInterface, 'syncAutomationEvents'):
await chatInterface.syncAutomationEvents()
logger.info("Automation events synced on startup")
except Exception as e:
logger.error(f"Error syncing automation events on startup: {str(e)}")
# Don't fail startup if automation sync fails
# Feature ...
return True
async def stop() -> None:
""" Stop feature triggers and background managers """
# Feature ...
return True