updated the connector config after refreshing the token

This commit is contained in:
CREDO23 2025-08-20 20:27:00 +02:00
parent 3d93fe8186
commit b0b6df0971
3 changed files with 72 additions and 13 deletions

View file

@ -60,6 +60,27 @@ async def get_connector_by_id(
return result.scalars().first()
async def get_connector_by_type(
session: AsyncSession, connector_type: SearchSourceConnectorType
) -> SearchSourceConnector | None:
"""
Get a connector by type from the database.
Args:
session: Database session
connector_type: Type of the connector
Returns:
Connector object if found, None otherwise
"""
result = await session.execute(
select(SearchSourceConnector).filter(
SearchSourceConnector.connector_type == connector_type,
)
)
return result.scalars().first()
def calculate_date_range(
connector: SearchSourceConnector,
start_date: str | None = None,

View file

@ -129,7 +129,7 @@ async def index_google_gmail_messages(
# Fetch recent Google gmail messages
logger.info(f"Fetching recent emails for connector {connector_id}")
messages, error = gmail_connector.get_recent_messages(
messages, error = await gmail_connector.get_recent_messages(
max_results=max_messages, days_back=days_back
)