This repository was archived by the owner on Jul 9, 2025. It is now read-only.
feat: pochta-worker#53
Closed
savurov wants to merge 1 commit into
Closed
Conversation
niqzart
reviewed
Oct 7, 2024
Comment on lines
+2
to
+3
|
|
||
| import redis |
Comment on lines
+12
to
+13
|
|
||
| RedisConnectionDep = Annotated[redis.asyncio.Redis, Depends(get_redis_connection)] |
Member
There was a problem hiding this comment.
suggestion: Это просто RedisConnection
Member
There was a problem hiding this comment.
suggestion: Вытащить это в common
Contributor
Author
There was a problem hiding this comment.
вместо common пока просто вытащил в workers/pochta_rds.py
Comment on lines
+7
to
+8
|
|
||
| @router.get("/") |
Comment on lines
+12
to
+13
|
|
||
| BLOCK_TIME_MS: int = 2000 |
Comment on lines
+13
to
+17
| @redis_consumer( | ||
| stream_name=REDIS_POCHTA_STREAM, consumer_name="pochta_consumer", model=PochtaModel | ||
| ) | ||
| async def process_email_message(message: PochtaModel) -> None: | ||
| print(f"Message: {message}") # noqa T201 # temporary print |
Member
There was a problem hiding this comment.
issue(обсудили голосом): Это невозможно импортировать, надо чего-то подумать
Comment on lines
+20
to
+14
| @asynccontextmanager | ||
| async def lifespan() -> AsyncIterator[None]: | ||
| tasks = [] | ||
| for worker in redis_consumers: | ||
| worker_task = asyncio.create_task(worker.run()) | ||
| tasks.append(worker_task) | ||
| yield | ||
| for task in tasks: | ||
| task.cancel() | ||
|
|
||
|
|
||
| mub_router = APIRouterExt(prefix="/mub", dependencies=[MUBProtection]) | ||
| mub_router.include_router(pochta_mub.router, prefix="/pochta") | ||
|
|
||
| api_router = APIRouterExt() | ||
| api_router.include_router(mub_router) |
Member
There was a problem hiding this comment.
polish: Обычно оно в обратном порядке
Comment on lines
+18
to
+19
|
|
||
| redis_consumers: list[RedisStreamConsumer] = [] |
8603fba to
f654fd2
Compare
f654fd2 to
ba5c2a3
Compare
5f85af2 to
ba5c2a3
Compare
Member
|
Закрыто в связи с переносом репозитория и изменения реализации в пользу использования FastStream |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.