Summary
Three call sites send Kafka messages one-at-a-time by wrapping single items in a list and calling put([item]) inside a loop, instead of collecting all messages and calling put(items) once.
The put() method already accepts list[T] and iterates internally. The callers just need to batch.
Affected locations
bases/bot_detector/worker_hiscore/core.py:116-121 — loops and calls put([_data_to_predict]) per record
bases/bot_detector/api_public/src/app/repositories/report.py:109 — [producer.put([report]) for report in reports]
bases/bot_detector/job_hs_migration_v3/core.py:168 — *[producer.put([d]) for d in data]
Proposed Change
Collect all transformed messages into a single list and call put() once (or chunk into reasonable batch sizes if needed).
Summary
Three call sites send Kafka messages one-at-a-time by wrapping single items in a list and calling
put([item])inside a loop, instead of collecting all messages and callingput(items)once.The
put()method already acceptslist[T]and iterates internally. The callers just need to batch.Affected locations
bases/bot_detector/worker_hiscore/core.py:116-121— loops and callsput([_data_to_predict])per recordbases/bot_detector/api_public/src/app/repositories/report.py:109—[producer.put([report]) for report in reports]bases/bot_detector/job_hs_migration_v3/core.py:168—*[producer.put([d]) for d in data]Proposed Change
Collect all transformed messages into a single list and call
put()once (or chunk into reasonable batch sizes if needed).