feat(examples): add task that produces#115820
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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() |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 91b60a3. Configure here.
91b60a3 to
e81db28
Compare


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