Skip to content

Commit

Permalink
Give functions proper name
Browse files Browse the repository at this point in the history
  • Loading branch information
koldakov committed Jan 9, 2024
1 parent b808dd0 commit e646df5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/routers/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sqlalchemy.ext.asyncio.session import AsyncSession

from app.repositories.sessions import get_async_session
from app.services.notifications import CharacterMove, process_sse
from app.services.notifications import CharacterMove, process_character_sse

router = APIRouter(
prefix="/notifications",
Expand All @@ -20,7 +20,7 @@
},
status_code=status.HTTP_200_OK,
)
async def sse(
async def character_sse(
character_id: int,
request: Request,
session: AsyncSession = Depends(get_async_session),
Expand All @@ -33,4 +33,4 @@ async def sse(
It facilitates real-time updates on character path.
Exercise caution when using this endpoint to ensure responsible and accurate data retrieval.
"""
return await process_sse(character_id, request, session)
return await process_character_sse(character_id, request, session)
6 changes: 3 additions & 3 deletions app/services/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CharacterMove(BaseModel):
time: datetime = datetime.now()


async def character_move_generator(
async def generate_character_move(
request: Request,
character: Character,
/,
Expand All @@ -51,11 +51,11 @@ async def character_move_generator(
await sleep(randint(1, 3))


async def process_sse(
async def process_character_sse(
character_id: int,
request: Request,
session: AsyncSession,
/,
) -> EventSourceResponse:
character: Character = await get_character(character_id, session)
return EventSourceResponse(character_move_generator(request, character))
return EventSourceResponse(generate_character_move(request, character))

0 comments on commit e646df5

Please sign in to comment.