Skip to content

Commit

Permalink
Log errors in the timeout background task
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur committed May 2, 2023
1 parent e54848d commit 4669480
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import asyncio
import logging
from abc import ABC, abstractmethod
from contextlib import suppress
from typing import TYPE_CHECKING, Any, AsyncGenerator, Callable, Dict, List, Optional
Expand Down Expand Up @@ -35,6 +36,8 @@


class BaseGraphQLTransportWSHandler(ABC):
task_logger: logging.Logger = logging.getLogger("strawberry.ws.task")

def __init__(
self,
schema: BaseSchema,
Expand Down Expand Up @@ -116,9 +119,8 @@ async def handle_connection_init_timeout(self) -> None:
# so that unittests can inspect it.
self.completed_tasks.append(task)

async def handle_task_exception(self, _: Exception) -> None:
# TODO: Log the error
pass # pragma: no cover
async def handle_task_exception(self, error: Exception) -> None:
self.task_logger.exception("Exception in worker task", exc_info=error)

async def handle_message(self, message: dict) -> None:
handler: Callable
Expand Down

0 comments on commit 4669480

Please sign in to comment.