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

feat: add metadata task #838

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

alabarjasteh
Copy link

A field has been introduced to the Task for carrying values across API boundaries. It can be utilized to address cross-cutting concerns, including distributed tracing, as highlighted in issues #547 and #774 .

Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 58.33333% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 68.29%. Comparing base (38f7499) to head (3b46717).
Report is 2 commits behind head on master.

Files Patch % Lines
metadata.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #838      +/-   ##
==========================================
- Coverage   68.41%   68.29%   -0.13%     
==========================================
  Files          27       28       +1     
  Lines        3841     3858      +17     
==========================================
+ Hits         2628     2635       +7     
- Misses        929      939      +10     
  Partials      284      284              

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

Copy link
Collaborator

@kamikazechaser kamikazechaser left a comment

Choose a reason for hiding this comment

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

I would suggest using functional arguments. I would refactor this entire PR to use something like:

asynq.Metadata which implements Option

Anyways the API needs to be discussed first. The PR should definitely be non-breaking to be included in the next release.

@@ -44,19 +48,21 @@ func (t *Task) ResultWriter() *ResultWriter { return t.w }

// NewTask returns a new Task given a type name and payload data.
// Options can be passed to configure task processing behavior.
func NewTask(typename string, payload []byte, opts ...Option) *Task {
func NewTask(typename string, payload []byte, md Metadata, opts ...Option) *Task {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a breaking change.

@shuqingzai
Copy link

#547

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

Successfully merging this pull request may close these issues.

3 participants