Skip to content

feat(examples): add task that produces#115820

Merged
bmckerry merged 4 commits into
masterfrom
ben/example-task-produce
May 19, 2026
Merged

feat(examples): add task that produces#115820
bmckerry merged 4 commits into
masterfrom
ben/example-task-produce

Conversation

@bmckerry
Copy link
Copy Markdown
Member

This PR adds an example task that uses the TaskProducer API to produce tasks. I'll be using this to compare taskworker performance while it tracks or ignores produced futures.

@bmckerry bmckerry requested a review from a team as a code owner May 19, 2026 17:11
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 19, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 91b60a3. Configure here.

topic=Topic(destination_topic),
payload=KafkaPayload(key=None, value=payload, headers=[]),
)
kafka_producer.close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

KafkaProducer resource leak if produce raises exception

Low Severity

The kafka_producer is created at line 139 but kafka_producer.close() at line 148 is not guarded by a try/finally block. If producer.produce() raises an exception during any iteration of the loop, the Kafka producer's underlying connection will never be closed, leaking the resource. The existing SingletonProducer pattern in arroyo_producer.py properly handles cleanup through atexit and _shutdown, which this code bypasses.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 91b60a3. Configure here.

Comment thread src/sentry/taskworker/tasks/examples.py
Comment thread src/sentry/taskworker/tasks/examples.py
Comment thread src/sentry/taskworker/tasks/examples.py
Base automatically changed from ben/tb-c-0.1.15 to master May 19, 2026 17:22
@bmckerry bmckerry requested a review from a team as a code owner May 19, 2026 17:22
@bmckerry bmckerry force-pushed the ben/example-task-produce branch from 91b60a3 to e81db28 Compare May 19, 2026 17:26
@bmckerry bmckerry merged commit af87f69 into master May 19, 2026
85 checks passed
@bmckerry bmckerry deleted the ben/example-task-produce branch May 19, 2026 18:23
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