taskiq-python / taskiq

Distributed task queue with full async support
MIT License
694 stars 44 forks source link

Added non-string labels in tasks. #243

Closed s3rius closed 5 months ago

s3rius commented 7 months ago

This problem was highlighted by @asvetlov in the https://github.com/taskiq-python/taskiq-pipelines/pull/14.

I was thinking about possible APIs for implementation this functionality and came up with this one. Now, along with dict of labels we store dict of labels types. To minimize amount of space for this information I've chosen to use ints over anything else. This solution is not perfect, but it's the most elegant solution I could come up with.

Possible improvements for the future:

This request should be backward compatible, but might brake some custom middlewares.

codecov-commenter commented 7 months ago

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (11bebcc) 77.20% compared to head (9d0326a) 77.75%.

Files Patch % Lines
taskiq/labels.py 88.00% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #243 +/- ## =========================================== + Coverage 77.20% 77.75% +0.55% =========================================== Files 60 61 +1 Lines 1750 1789 +39 =========================================== + Hits 1351 1391 +40 + Misses 399 398 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

s3rius commented 7 months ago

@asvetlov, mind taking a look at the request? I'd be very grateful, since this functionality affects your PR as well.

Thanks in advance.