PrefectHQ
prefect
BlogDocsChangelog

Fix AttributeError in Consumer.cleanup() for non-memory brokers

#20089Merged
Comparing
devin/1767321952-fix-consumer-cleanup-method
(
4a88d76
) with
main
(
d656417
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s
bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
602.1 µs603.5 µs

Ignored

bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+32%
11.2 ms8.5 ms
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-2%
33 ms33.5 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-6%
5.4 ms5.8 ms
bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-3%
159 ms163.3 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.6 ms107.4 ms

Commits

Click on a commit to change the comparison range
Base
main
d656417
-0.13%
Add cleanup() method to base Consumer class This fixes an AttributeError that occurs when using non-memory messaging brokers (like Redis) during server shutdown. The cleanup() method was added to the memory Consumer in commit 884b1fd8596 but was not added to the abstract base class, causing the Redis Consumer to fail when EventPersister.stop() calls self.consumer.cleanup(). The fix adds a default no-op cleanup() method to the base Consumer class, which is appropriate for consumers that don't need explicit cleanup (like Redis), while allowing subclasses to override it when needed (like the memory Consumer does to unsubscribe from topics). Fixes the error: AttributeError: 'Consumer' object has no attribute 'cleanup' Co-Authored-By: Nate Nowack <nate@prefect.io>
4a88d76
14 hours ago
by devin-ai-integration[bot]
© 2026 CodSpeed Technology
Home Terms Privacy Docs