-
-
Notifications
You must be signed in to change notification settings - Fork 701
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
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. |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
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 .