Skip to content

Batch Kafka produces instead of one-by-one in worker_hiscore, api_public, and migration job #131

@extreme4all-ai

Description

@extreme4all-ai

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

  1. bases/bot_detector/worker_hiscore/core.py:116-121 — loops and calls put([_data_to_predict]) per record
  2. bases/bot_detector/api_public/src/app/repositories/report.py:109[producer.put([report]) for report in reports]
  3. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions