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 a flag to wait for delivery callback in taskworker #83167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

evanh
Copy link
Member

@evanh evanh commented Jan 9, 2025

Sometimes it is helpful to have the taskworker actually wait for the kafka producer to acknowledge
that the sent task has been successfully added to Kafka. In particular this is useful for testing
scenarios. Add a flag to the task definition that can determine whether the worker should wait for
the produce to be acknowledged before continuing.

Sometimes it is helpful to have the taskworker actually wait for the kafka producer to acknowledge
that the sent task has been successfully added to Kafka. In particular this is useful for testing
scenarios. Add a flag to the task definition that can determine whether the worker should wait for
the produce to be acknowledged before continuing.
@evanh evanh requested a review from a team as a code owner January 9, 2025 17:02
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 9, 2025
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/taskworker/registry.py 75.00% 1 Missing ⚠️
src/sentry/taskworker/task.py 50.00% 1 Missing ⚠️
src/sentry/taskworker/tasks/examples.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #83167      +/-   ##
==========================================
- Coverage   87.59%   87.58%   -0.01%     
==========================================
  Files        9459     9461       +2     
  Lines      536667   536917     +250     
  Branches    21116    21116              
==========================================
+ Hits       470088   470274     +186     
- Misses      66220    66284      +64     
  Partials      359      359              

src/sentry/taskworker/registry.py Outdated Show resolved Hide resolved

activation = simple_task.create_activation()

with patch.object(namespace, "producer") as mock_producer:
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't the mock need to return a Future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants