Skip to content

experiment separate Broker + Router#624

Draft
GefMar wants to merge 1 commit into
masterfrom
experiment/separate_broker
Draft

experiment separate Broker + Router#624
GefMar wants to merge 1 commit into
masterfrom
experiment/separate_broker

Conversation

@GefMar
Copy link
Copy Markdown
Member

@GefMar GefMar commented May 16, 2026

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.18%. Comparing base (cc1b355) to head (e9410c7).

Files with missing lines Patch % Lines
taskiq/router.py 85.03% 19 Missing ⚠️
taskiq/task_builder.py 82.50% 7 Missing ⚠️
taskiq/flow.py 81.48% 5 Missing ⚠️
taskiq/kicker.py 86.48% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #624      +/-   ##
==========================================
+ Coverage   79.79%   80.18%   +0.39%     
==========================================
  Files          69       72       +3     
  Lines        2529     2771     +242     
==========================================
+ Hits         2018     2222     +204     
- Misses        511      549      +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@s3rius s3rius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well. Although the intention is good for sure.

But I see several problems with the solution you provided. Most importantly I see that brokers are referenced by strings almost everywhere. Which is problematic.

Also, since everything is implicit, it's hard to resolve conflicts in this setup. Like, what if I have multiple routers. I guess by design it's highly advised to only use one instance of router per project, but most probably people would not care about this constraint, since it's not enforced.

I'm not quite sure about Flow concept. Although multiple queue support is highly anticipated by the community, and I'm fully up for its support. But this implementation lacks some fundamental abilities for future expansion. Different brokers might have their own different parameters on Queues. For example RabbitMQ has lots of things that it can do with a queue.

And I'm not quite sure about flow_kind. It seems a bit redundant. Or I didn't catch the meaning of it.

I still like the intention. But I guess it need to be redesigned.

Comment thread taskiq/flow.py
)

@classmethod
def queue(cls, name: str, **options: Any) -> "Flow":
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what are odds in using different flow kinds? How are they going to differ?


router.route_task(
send_email.task_name,
broker="priority",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referencing by a magic string is not a good idea. I guess placing a broker value in here would be much better.

try:
direct_result = await send_email(7, "welcome")

routed_task = await send_email.kiq(7, "welcome")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It says that the task is routed, but it's very implicit.

routed_result = await routed_task.wait_result(timeout=2)

bulk_task = await send_email.kicker().with_route(
"default",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants