consolidate the retry mechanism into the handle_http_errors decorator, mitigates idempotency risks by limiting retries to read-only operations

This commit is contained in:
Taylor Wilsdon
2025-07-17 13:57:21 -04:00
parent 181ffb650d
commit f08373a8b2
9 changed files with 116 additions and 165 deletions

View File

@@ -13,7 +13,7 @@ from googleapiclient.errors import HttpError
from auth.service_decorator import require_google_service
from core.server import server
from core.utils import handle_http_errors, retry_on_ssl_error
from core.utils import handle_http_errors
from core.comments import create_comment_tools
# Configure module logger
@@ -21,9 +21,8 @@ logger = logging.getLogger(__name__)
@server.tool()
@handle_http_errors("list_spreadsheets", is_read_only=True)
@require_google_service("drive", "drive_read")
@handle_http_errors("list_spreadsheets")
@retry_on_ssl_error()
async def list_spreadsheets(
service,
user_google_email: str,
@@ -71,9 +70,8 @@ async def list_spreadsheets(
@server.tool()
@handle_http_errors("get_spreadsheet_info", is_read_only=True)
@require_google_service("sheets", "sheets_read")
@handle_http_errors("get_spreadsheet_info")
@retry_on_ssl_error()
async def get_spreadsheet_info(
service,
user_google_email: str,
@@ -122,9 +120,8 @@ async def get_spreadsheet_info(
@server.tool()
@handle_http_errors("read_sheet_values", is_read_only=True)
@require_google_service("sheets", "sheets_read")
@handle_http_errors("read_sheet_values")
@retry_on_ssl_error()
async def read_sheet_values(
service,
user_google_email: str,
@@ -173,9 +170,8 @@ async def read_sheet_values(
@server.tool()
@require_google_service("sheets", "sheets_write")
@handle_http_errors("modify_sheet_values")
@retry_on_ssl_error()
@require_google_service("sheets", "sheets_write")
async def modify_sheet_values(
service,
user_google_email: str,
@@ -245,9 +241,8 @@ async def modify_sheet_values(
@server.tool()
@require_google_service("sheets", "sheets_write")
@handle_http_errors("create_spreadsheet")
@retry_on_ssl_error()
@require_google_service("sheets", "sheets_write")
async def create_spreadsheet(
service,
user_google_email: str,
@@ -295,9 +290,8 @@ async def create_spreadsheet(
@server.tool()
@require_google_service("sheets", "sheets_write")
@handle_http_errors("create_sheet")
@retry_on_ssl_error()
@require_google_service("sheets", "sheets_write")
async def create_sheet(
service,
user_google_email: str,
@@ -350,7 +344,7 @@ _comment_tools = create_comment_tools("spreadsheet", "spreadsheet_id")
# Extract and register the functions
read_sheet_comments = _comment_tools['read_comments']
create_sheet_comment = _comment_tools['create_comment']
create_sheet_comment = _comment_tools['create_comment']
reply_to_sheet_comment = _comment_tools['reply_to_comment']
resolve_sheet_comment = _comment_tools['resolve_comment']