Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to broker.serializer instead of JSON-only solution #14

Merged
merged 2 commits into from
Jul 7, 2024

Conversation

asvetlov
Copy link
Contributor

@asvetlov asvetlov commented Oct 29, 2023

The code works well but contains a dirty hack for parsing pipeline data from task labels.

Pipeline loads()/dumps() are loadb()/dumpb() now.

Step's loads()/dumps() are gone away, seems like they don't override anything actually but all have the same code.

I'm not sure if the PR should be merged as is.

@s3rius please consider it as the idea demonstration.
If you agree with the code in general, I'll make bytes support to message labels first, and remove the hack later.

P.S. Sorry for two-week delay. Tests were hanging without any exception or log message. It took a while to figure out how to debug the problem.

Copy link
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.

Request itself is really nice. Thank you. But I will publish a new release of a core library, so the code will be less error-prone and more readable.

# in `AsyncKicker._prepare_message`.
# The trick can be removed later after adding explicit `bytes` support.
if ( # noqa: WPS337
isinstance(pipeline_data, str)
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering is this because of this line:

https://github.com/taskiq-python/taskiq/blob/a74fa4d4bc47662ea46dc3af51c156fc23c21d94/taskiq/kicker.py#L253

Maybe before merging we can add support for bytes in labels, by removing this str modifier? Since I really don't like how it looks. Guess removig str should give no effect, bu might break compatibility. I will find out how to make it possible without big compatibility problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly. It is the result of str(label) conversion.

I suspect that the plain str(...) removal is not enough. Let me experiment first and come up with a PR for taskiq core project.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I tried removing it and broke tests.

@s3rius
Copy link
Member

s3rius commented Nov 3, 2023

I also had no time to review it, sorry. Was busy as a bee on work.

@asvetlov
Copy link
Contributor Author

asvetlov commented Nov 6, 2023

I also had no time to review it, sorry. Was busy as a bee on work.

Don't rush please, a few days don't change the university :)

@s3rius s3rius changed the base branch from master to develop July 7, 2024 12:55
@s3rius s3rius merged commit 67afc9d into taskiq-python:develop Jul 7, 2024
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