diff --git a/surfsense_backend/app/connectors/notion_history.py b/surfsense_backend/app/connectors/notion_history.py index b347eb9c6..ff8478905 100644 --- a/surfsense_backend/app/connectors/notion_history.py +++ b/surfsense_backend/app/connectors/notion_history.py @@ -171,7 +171,9 @@ class NotionHistoryConnector: # Final validation: ensure we have a valid access_token after all processing final_token = config_data.get("access_token") - if not final_token or (isinstance(final_token, str) and not final_token.strip()): + if not final_token or ( + isinstance(final_token, str) and not final_token.strip() + ): raise ValueError( "Notion access token is invalid or empty. " "Please remove and re-add the Notion connector." @@ -356,9 +358,7 @@ class NotionHistoryConnector: ) except Exception as callback_error: # Don't let callback errors break the retry logic - logger.warning( - f"Retry callback failed: {callback_error}" - ) + logger.warning(f"Retry callback failed: {callback_error}") # Wait before retrying await asyncio.sleep(wait_time) @@ -588,9 +588,7 @@ class NotionHistoryConnector: except APIResponseError as e: error_message = str(e) # Check if this is an unsupported block type error - if any( - err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS - ): + if any(err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS): logger.warning( f"Skipping page blocks due to unsupported block type in page {page_id}: {error_message}" ) @@ -683,9 +681,7 @@ class NotionHistoryConnector: except APIResponseError as e: error_message = str(e) # Check if this is an unsupported block type error - if any( - err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS - ): + if any(err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS): logger.warning( f"Skipping children of block {block_id} due to unsupported block type: {error_message}" ) diff --git a/surfsense_backend/app/services/notification_service.py b/surfsense_backend/app/services/notification_service.py index 1a91d000f..e0385b91c 100644 --- a/surfsense_backend/app/services/notification_service.py +++ b/surfsense_backend/app/services/notification_service.py @@ -382,9 +382,7 @@ class ConnectorIndexingNotificationHandler(BaseNotificationHandler): "temporary_error": f"{service_name} temporarily unavailable", } - base_message = retry_messages.get( - retry_reason, f"Waiting for {service_name}" - ) + base_message = retry_messages.get(retry_reason, f"Waiting for {service_name}") # Add wait time and progress info if wait_seconds and wait_seconds > 5: diff --git a/surfsense_backend/app/tasks/connector_indexers/notion_indexer.py b/surfsense_backend/app/tasks/connector_indexers/notion_indexer.py index b8d2297c5..a65bf84a7 100644 --- a/surfsense_backend/app/tasks/connector_indexers/notion_indexer.py +++ b/surfsense_backend/app/tasks/connector_indexers/notion_indexer.py @@ -534,7 +534,9 @@ async def index_notion_pages( "Using legacy token. Reconnect with OAuth for better reliability." ) - user_notification_message = " ".join(notification_parts) if notification_parts else None + user_notification_message = ( + " ".join(notification_parts) if notification_parts else None + ) return ( total_processed,