mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-17 18:35:19 +02:00
chore: linting
This commit is contained in:
parent
8e6826dd66
commit
d39bf3510f
3 changed files with 10 additions and 14 deletions
|
|
@ -171,7 +171,9 @@ class NotionHistoryConnector:
|
||||||
|
|
||||||
# Final validation: ensure we have a valid access_token after all processing
|
# Final validation: ensure we have a valid access_token after all processing
|
||||||
final_token = config_data.get("access_token")
|
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(
|
raise ValueError(
|
||||||
"Notion access token is invalid or empty. "
|
"Notion access token is invalid or empty. "
|
||||||
"Please remove and re-add the Notion connector."
|
"Please remove and re-add the Notion connector."
|
||||||
|
|
@ -356,9 +358,7 @@ class NotionHistoryConnector:
|
||||||
)
|
)
|
||||||
except Exception as callback_error:
|
except Exception as callback_error:
|
||||||
# Don't let callback errors break the retry logic
|
# Don't let callback errors break the retry logic
|
||||||
logger.warning(
|
logger.warning(f"Retry callback failed: {callback_error}")
|
||||||
f"Retry callback failed: {callback_error}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Wait before retrying
|
# Wait before retrying
|
||||||
await asyncio.sleep(wait_time)
|
await asyncio.sleep(wait_time)
|
||||||
|
|
@ -588,9 +588,7 @@ class NotionHistoryConnector:
|
||||||
except APIResponseError as e:
|
except APIResponseError as e:
|
||||||
error_message = str(e)
|
error_message = str(e)
|
||||||
# Check if this is an unsupported block type error
|
# Check if this is an unsupported block type error
|
||||||
if any(
|
if any(err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS):
|
||||||
err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS
|
|
||||||
):
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Skipping page blocks due to unsupported block type in page {page_id}: {error_message}"
|
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:
|
except APIResponseError as e:
|
||||||
error_message = str(e)
|
error_message = str(e)
|
||||||
# Check if this is an unsupported block type error
|
# Check if this is an unsupported block type error
|
||||||
if any(
|
if any(err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS):
|
||||||
err in error_message for err in UNSUPPORTED_BLOCK_TYPE_ERRORS
|
|
||||||
):
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Skipping children of block {block_id} due to unsupported block type: {error_message}"
|
f"Skipping children of block {block_id} due to unsupported block type: {error_message}"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -382,9 +382,7 @@ class ConnectorIndexingNotificationHandler(BaseNotificationHandler):
|
||||||
"temporary_error": f"{service_name} temporarily unavailable",
|
"temporary_error": f"{service_name} temporarily unavailable",
|
||||||
}
|
}
|
||||||
|
|
||||||
base_message = retry_messages.get(
|
base_message = retry_messages.get(retry_reason, f"Waiting for {service_name}")
|
||||||
retry_reason, f"Waiting for {service_name}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add wait time and progress info
|
# Add wait time and progress info
|
||||||
if wait_seconds and wait_seconds > 5:
|
if wait_seconds and wait_seconds > 5:
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,9 @@ async def index_notion_pages(
|
||||||
"Using legacy token. Reconnect with OAuth for better reliability."
|
"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 (
|
return (
|
||||||
total_processed,
|
total_processed,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue